|
On 4/15/2011 4:15 AM, Abdul Rauf Anwar wrote:
> Hi
> this would be stupid but i cant find a way to rename a matrix during loop iterations
> see
> eval(['y_' num2str(counter) '=' x(:,i:i+9) ])
> in this statement i want 'y' to be matrix and since this very line will
> run 10 times so at the end i should have 10 different matrices as y_1, y_2, ...,y_10
> but i suppose this line works only as singular value
> i would be obliged if someone helps me out of this
> Thanks
I do not think the above is a good way to do things.
If you want at the end 10 different matrices, then
make a 3D matrix, and use the index to locate
your 10 matrices.
This allocates 10 matrix, each of size 5 by 5:
A=zeros(5,5,10);
Simply then do
c = A(:,:,i)
to obtain the 'ith' matrix.
It is important to first sit and think carfully about your data
structure.
Remember what Wirth said: algorithms + data structures - programs
--Nasser
|