for loop within for loop

12 ビュー (過去 30 日間)
Hinna Ahmed
Hinna Ahmed 2019 年 11 月 4 日
コメント済み: ME 2019 年 11 月 4 日
Hey,
I want to make two for loops. the first for loop is when the values are j = [1:4,5:8,9:2,13:6,7:20,21:24]
because I am using this for a subplot, so when j = 1 or j=5 or j=9 or j=13 or j=17 or j=21 then i=1.
When j=2, j=6 ,j=10 , j=14 , j=18 or j=22 then i=2.
When j=3, j=7, j=11, j=15, j=19 or j=23 then i=3.
When j=4, j=8, j=12, j=16, j=20, j=24 then i=4.

採用された回答

ME
ME 2019 年 11 月 4 日
I don't know what you want to do inside those for loops so I can't give you full code but the loops you'll want are:
for i=1:4;
for j=i:4:24;
end
end
  12 件のコメント
Hinna Ahmed
Hinna Ahmed 2019 年 11 月 4 日
THANK YOU SO MUCH!! :D
ME
ME 2019 年 11 月 4 日
No problem, happy to help!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeAnnotations についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by