About a for loop matrix
1 回表示 (過去 30 日間)
古いコメントを表示
for k=2:mx-1
for j=2:mx-2
A(k,j-1) = (D*dt)/dx^(2)+U*dt/(2*dx);
break
end
break
end
I set there is a zeros matrix with mx column and mx row and I want to find the points (2,1), (3,2), (4,3), (5,4) etc. Now it only show 1 column at (2,1) point. But if I delete two breaks, it will keep loop the second loop. How can I fix this???
0 件のコメント
採用された回答
Walter Roberson
2017 年 1 月 25 日
編集済み: Walter Roberson
2017 年 1 月 25 日
for k=2:mx-1
j=k+2;
A(k,j-1) = (D*dt)/dx^(2)+U*dt/(2*dx);
end
0 件のコメント
その他の回答 (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!