且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

将Matlab矩阵分成几个相等的部分

更新时间:2022-04-25 21:39:33

您可以使用mat2cell和此oneliner

You can use mat2cell and this oneliner

C = mat2cell(A, repmat(12900, 5, 1), 17);

mat2cell的第二个参数是矩阵的行拆分.

The second parameter to mat2cell is the row split of the matrix.

现在C是一个单元格数组:

Now C is a cell array:

C = 

[12900x17 double]
[12900x17 double]
[12900x17 double]
[12900x17 double]
[12900x17 double]

和部分矩阵可以按以下方式访问

and the partial matrices can be accessed as

C{1} etc.