Calling matrices automatically with matlab
信息
此问题已关闭。 请重新打开它进行编辑或回答。
显示 更早的评论
I have three matrices:
elem1 = (1,1) elem2 = (2,2) elem3 = (3,3)
I want to call these matrices in a for loop such as
for i=1:3
A(i,1)=elem(i)
end
How should I write elem(i) correctly to call elem matrices?
0 个评论
回答(2 个)
Azzi Abdelmalek
2013-12-23
编辑:Azzi Abdelmalek
2013-12-23
elem1 = [1,1]
elem2 = [2,2]
elem3 = [3,3]
for k=1:3
eval(sprintf('a=elem%d',k));
A(k,1:n)=a
end
0 个评论
此问题已关闭。
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!