- Most efficient way:
I want to store data in a matrix from a for loop using non integer indexing
1 回表示 (過去 30 日間)
古いコメントを表示
Arjun Upadhyay
2020 年 8 月 15 日
コメント済み: Arjun Upadhyay
2020 年 8 月 19 日
Here is the simple version of my code.
x = [5:0.1:20];
for v = 1:.1:10
R = v.*x;
mat(v,:)=R;
end
I want to store data in a matrix 'mat' for each iteration . Please suggest me how to do this.
0 件のコメント
採用された回答
Sulaymon Eshkabilov
2020 年 8 月 15 日
Hi,
There are several ways of doing it:
x = [5:0.1:20];
v = (1:.1:10)';
MAT=v.*x;
2. Least efficient way:
for ii=1:numel(v)
MAT(ii,:)=v(ii)*x;
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!