フィルターのクリア

how to create two counter loops that run at the same time in matlab??

3 ビュー (過去 30 日間)
Sandeep Kumar
Sandeep Kumar 2016 年 2 月 4 日
回答済み: Jason Platzer 2018 年 2 月 22 日
hello every one, how to create two counter loops that start at the same time in matlab editor and gets applied on given code at the same time using for loop??
for example: counter "1" should run like 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16. counter "2" should run like 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4. for the same code, kindly help me.

採用された回答

Stephen23
Stephen23 2016 年 2 月 4 日
This loop:
for m = 1:16
n = 1+mod(m-1,4);
disp([m,n])
end
displays the variables m and n in the command window:
1 1
2 2
3 3
4 4
5 1
6 2
7 3
8 4
9 1
10 2
11 3
12 4
13 1
14 2
15 3
16 4

その他の回答 (1 件)

Jason Platzer
Jason Platzer 2018 年 2 月 22 日
Thanks very much. This was very helpful.

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by