using mat2cell

5 次查看(过去 30 天)
Joseph Lee
Joseph Lee 2017-10-31
评论: Star Strider 2017-10-31
M is matrix of 2010x1300
how do i form 201 cells of 10x1300 using mat2cell?

采纳的回答

Star Strider
Star Strider 2017-10-31
This works:
M = randn(2010, 1300);
C = mat2cell(M, 201*ones(1,10), 1300);
See the documentation for an explanation.
  4 个评论
Joseph Lee
Joseph Lee 2017-10-31
thanks!
Star Strider
Star Strider 2017-10-31
My pleasure!
Since my Answer solves the problem you originally posted, please Accept it!

请先登录,再进行评论。

更多回答(1 个)

M
M 2017-10-31
Maybe not the easiest solution, but try something like :
j=1;
for i=1:10:201
A{j}=M(i:i+9,:);
j=j+1;
end
  1 个评论
Joseph Lee
Joseph Lee 2017-10-31
Your solution worked but without the 10
for i=1:201
A{j}=M(i:i+9,:);
j=j+1;
end

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Matrix Indexing 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by