matrix index (I tried to name a matrix to use in a loop like variables.)
1 回表示 (過去 30 日間)
古いコメントを表示
I tried to name a matrix to use in a loop like variables.
forexample A(1)=[1 2;3 4]
A(2)=A(1)*2
A(3)=A(2)*2
.
.
.
A(j)=A(j-1)*2
But I can't use the notation A(j) in the loop. what should I call the j of A?
0 件のコメント
回答 (2 件)
Azzi Abdelmalek
2015 年 7 月 24 日
編集済み: Azzi Abdelmalek
2015 年 7 月 24 日
You can use cell arrays
A=cell(1,4)
A{1}=[1 2;3 4]
for k=2:numel(A)
A{k}=A{k-1}*2
end
参考
カテゴリ
Help Center および File Exchange で Resizing and Reshaping Matrices についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!