how to change the increment in for loop?
조회 수: 3 (최근 30일)
이전 댓글 표시
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)
?
댓글 수: 0
채택된 답변
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
추가 답변 (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!