isCorrect = data(:,1) == data(:,2);怎么每100个计算一个和呢
时间: 2024-05-15 16:14:01 浏览: 17
你可以使用 `reshape` 函数将 `isCorrect` 向量重新塑形为一个 100 行的矩阵,然后对每一行求和。这样可以计算出每100个元素的和。
具体实现代码如下:
```matlab
isCorrect = data(:,1) == data(:,2);
sumEvery100 = sum(reshape(isCorrect, 100, []), 1);
```
其中,`reshape(isCorrect, 100, [])` 将 `isCorrect` 向量重新塑形为一个 100 行的矩阵,`sum(..., 1)` 对每一列求和,得到一个行向量,其中每个元素表示该位置之前的100个元素的和。
相关问题
json.decoder.JSONDecodeError: Extra data: line 2 column 1 (char 2567)
This error indicates that there is some extra data in the JSON file that the decoder cannot parse. It could be due to a missing comma or an extra bracket. You should check the JSON file and ensure that it is properly formatted and follows the correct syntax.
The following packages have unmet dependencies: cmake:i386 : Depends: libcurl4:i386 (>= 7.16.2) but it is not installable Depends: cmake-data:i386 (= 3.22.1-1ubuntu1) Recommends: gcc:i386 but it is not going to be installed Recommends: make:i386 E: Unable to correct problems, you have held broken packages
这个错误通常是因为你的系统无法满足所需的依赖关系。尝试运行以下命令来解决这个问题:
```
sudo apt-get update
sudo apt-get install -f
sudo apt-get install cmake
```
这将更新你的软件包列表并安装任何缺失的依赖项。如果问题仍然存在,你可以尝试手动安装缺失的依赖项。
相关推荐
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)