0

I need to create 10 empty cells: Outlier1, Outlier2,...,Outlier10, each being a different size. Due to the use of a previously existing loop, I'd like to do something like this:

for z=1:10

sprintf('Outlier%d',z)=cell(size(R,2),1);

end

Basically, each cell will have a different size due to the fact that R changes with z. However, if I do this, I receive this error:

Subscripted assignment dimension mismatch.

Could anyone tell me how to get around this?

Veedrac
  • 58,273
  • 15
  • 112
  • 169
A.Rainer
  • 719
  • 5
  • 16
  • I guessed I figured it out: XX=cell(size(R,2),1); eval(sprintf('Outlier%d=XX',z)); – A.Rainer May 25 '14 at 02:43
  • Yes. `eval` would be the way to go here. Consider either deleting this question, or answering it yourself and accepting your own answer. – rayryeng May 25 '14 at 02:48

1 Answers1

0
XX=cell(size(R,2),1); 

eval(sprintf('Outlier%d=XX',z));
rayryeng
  • 102,964
  • 22
  • 184
  • 193
A.Rainer
  • 719
  • 5
  • 16