A Varying matrix name in loop
3 次查看(过去 30 天)
显示 更早的评论
I have a loop running from i=1 to N where N is unkown and inputted by the user and the commands in the loop generates a matrix and i would like the first loop to give me matrix1 and the second loopd to give me matrix2 so the matrix name is changed based on the i value, but im not really sure how to go about this problem
1 个评论
采纳的回答
更多回答(1 个)
madhan ravi
2020-6-8
N = 2; % example
matrix = cell(N,1);
for k = 1:N
matrix{k} = rand;
end
celldisp(matrix)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Matrix Indexing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!