How to increment matrix row only inside a nested for loop?
2 ビュー (過去 30 日間)
古いコメントを表示
for i= 1:10{
for j= 1:5{
x = i*j;
mat
}}
matrix's row number index row wise should increment by 1
save this x value in mat matrix's row wise(like 1st row,2nd row,...,50th row).
Please help
回答 (1 件)
Bob Thompson
2019 年 11 月 7 日
The solution is indexing. You can do math in your index if you need to.
x((i-1)*5+j) = i*j;
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!