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

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -