How to create a cell array of k similar objects in Matlab?

Posted by Reed Richards on Stack Overflow See other posts from Stack Overflow or by Reed Richards
Published on 2010-05-30T16:52:43Z Indexed on 2010/05/30 17:32 UTC
Read the original article Hit count: 214

Filed under:
|
|

I want to create an 1,k cell of m,m matrices. I have some trouble trying to initialize it. My first idea was to do this

myCell = cell{1,K};
for k = 1:K
  myCell{1,k} = eye(m);
end 

But it seems like such ugly way to initialize it. There have to be a better way?

© Stack Overflow or respective owner

Related posts about matlab

Related posts about initialization