extract submatrix from a large matrix using loop

9 次查看(过去 30 天)
Dear friends, I have a matrix 1140 by 330. I have to split the matrix into 60 matrices with the size of 19*330 using a for loop. does any one know how to do that?

采纳的回答

Matt J
Matt J 2016-7-18
You can use MAT2TILES ( Download ). For example,
A=rand(1140,330);
C=mat2tiles(A,[19,330]);
  2 个评论
Sophi gra
Sophi gra 2016-7-18
编辑:Sophi gra 2016-7-18
if i want to calculate the correlation coefficient, does it calculate it seperately? I use corrcoef(C), and I got error!

请先登录,再进行评论。

更多回答(2 个)

Andrei Bobrov
Andrei Bobrov 2016-7-18
A=rand(1140,330);
out = permute(reshape(A',size(A,2),60,[]),[2,1,3]);

Guillaume
Guillaume 2016-7-18
m = rand(1140, 330); %demo matrix
splitm = mat2cell(m, ones(1, 60) * 19, 330)

类别

Help CenterFile Exchange 中查找有关 Creating and Concatenating Matrices 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by