MATLAB: Change Array Name In Each Loop

arrayloopvariable

I'm writing a For loop and want to create an array each loop, with the name changed according to the loop counter; e.g., Coll1, Coll2, Coll3, etc. Before folks slaughter me for asking…I've already read on here where folks have asked the question and "experts" recoil sharply against them saying it's a very bad newbie idea. Instead they should use the same array name but use indexing. I get that. But in this case I don't think I can do that because in each iteration of the loop, the newly created array has different dimensions each time. So I don't want the largest one creating a slew of zero cells in the smaller ones just for the sake of using a single array name. Any tips on how I can do this?
Thanks in advance, M Ridzon

Best Answer

As per suggested, use a cell array.
C = cell(1, 10);
for n = 1:10
C{n} = rand(n); % size(C{n}) is [n n]
end
Each cell in C has a different sized matrix.