I am new to programming and I was wondering if my question has a simple implementation. I have a bunch of matrices and I want a way to be able to store them, or be able to easily call them and do operations on them. For example, if I have 100 matrices, called, M1,M2,...M100; is there a way I can rename them so that if I want to call the nth matrix, I can just write M(nth)?
EDIT: For example, if I want to add M1+M1, M1+M2, ...,M1+M100; I want to be able to write a loop something kind of like,
for i=1:100 AM(i)=M(1)+M(i) end
Is this possible?
Use cell array
AM = cell(1,100);
and set it as
AM{i} = Mi;
then you can access it as
AM{i};
note the use of {} to access each element of the cell array AM, that is in turn a matrix
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With