필터 지우기
필터 지우기

how to change the increment in for loop?

조회 수: 3 (최근 30일)
Sarah A
Sarah A 2018년 8월 1일
편집: madhan ravi 2018년 8월 2일
Hello,
I have this line of code in C++ and I need to know its equivalent in Matlab:
for (i =0 , i<100 , i=i+4)
?

채택된 답변

madhan ravi
madhan ravi 2018년 8월 1일
편집: madhan ravi 2018년 8월 1일
hi, this is how you do it:
for i = 0:4:(100-1)
i
end
EXPLANATION: O IS THE STARTING POINT AND 4 IS THE INCREMENT , IT GOES ALL THE WAY UP UNTIL THE LIMIT (100-1)<=>99
  댓글 수: 2
Sarah A
Sarah A 2018년 8월 1일
Thank you :)
madhan ravi
madhan ravi 2018년 8월 2일
편집: madhan ravi 2018년 8월 2일
you're welcome

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

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