matlab - 如何使这些矩阵大小相同?
问题描述
我有 1x252 矩阵和 13x252 矩阵。我需要使它们匹配,以便我可以使用 corrcoef 找到相关系数。不完全确定如何使用该功能,并且我有一段时间没有做过很多matlab。
解决方案
如果没有更多关于如何在矩阵中配置数据的详细信息,这就是我想出的。该脚本使用该repmat()
函数重复/复制Matrix_1
此示例中的行。
%Random data sets%
Matrix_1 = rand(1,252);
Matrix_2 = rand(13,252);
%Repeating the rows of x to match the number of rows in y%
Matrix_1 = repmat(Matrix_1,13,1);
Correlation_Coefficients = corrcoef(Matrix_1,Matrix_2);
Correlation_Coefficients
使用 MATLAB 版本:R2019b
推荐阅读
- python-3.x - Aiocache @cached 装饰器不返回结果
- python-2.7 - 如何创建一个安装 python 依赖项的 RPM?
- android - 在多模块项目中集成 Crashlytics
- windows - 使用 powershell 从文件夹中复制特定文件
- javascript - 如何将我的 JSX 代码转换为 JS 对象?
- vba - 如何更新动态元素的字段(输入 ID 和名称)
- jquery - 如何在 AJAX Bootstrap 表单验证中允许空字段(非必填字段)?
- python - 如何在不打开大型csv文件的情况下读取每行的数字总和
- libvlc - 如何在 libvlc sharp 3.4.0 中更改字幕的字体和大小?
- android - 添加 TextInputLayout 后可能导致 ClassCastException 的原因