I'm writing a piece of code where I can define a number of matrices that will be generated and then a loop generates them. The piece where I'm struggling is on the "naming" of the matrices, since I want to name as follows: matrix1; matrix2; etc.
The code below is what I've got so far:
matrices_to_generate = 3;
for i=1:matrices_to_generate
['matrix' i] = rand(2,2);
end;
Using
assignin
, you can write a variable to the workspace with a custom name.