define a series of matrices variables not using cell in Matlab -
here code:
a = zeros(10,10,10); = 1:10 c{i} = a(:,:,i); end
this simple example , question is: there other way, not using cell (c{i} in code) represent series of 2d matrices variables (a(:,:,i) in code) 3d matrix (a). anyway believe need variable name 'i'.
thanks in advance!
you can do:
a = zeros(10,10,10); = 1:10 eval(sprintf('a%d = a(:,:,%d)',i,i)); end
in way 10 matrices names a1, a2, ..., ai,...
anyway suggest not using method. more readable 1 cell arrays.
Comments
Post a Comment