필터 지우기
필터 지우기

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

조회 수: 3 (최근 30일)
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 CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by