how to save for loop results
1 次查看(过去 30 天)
显示 更早的评论
Hello everyone Gud evening and happy new yr i m giving one matlab program below
n=5
for i=1:n
a=magic(i)
end
i want to modify this program such that all the 5 resulting matrices are saved and accessed by name
a1= magic 1 matix
a2= magic 2 matix
a3= magic 3 matix
a4= magic 4 matix
a5= magic 5 matix
would anybody please help me?
0 个评论
回答(2 个)
Hello kity
2013-1-3
编辑:Hello kity
2013-1-3
Creat cell array/ or normal matrix
n=5
a=cell(1,5)
for i=1:n
a{i}=magic(i)
end
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Loops and Conditional Statements 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!