skip a number after every two number in for loop
조회 수: 2 (최근 30일)
이전 댓글 표시
Hello,
I want to execute a for loop from value 1 to 10.
but within this range I want to skip number 3, 6 and 9. could you please help with the logic of skipping specific number at regular.
댓글 수: 0
채택된 답변
madhan ravi
2019년 1월 21일
편집: madhan ravi
2019년 1월 21일
L=1:10;
for k = L(~ismember(L,3:3:L(end)))
k
end
댓글 수: 4
madhan ravi
2019년 1월 21일
Thank you John D‘Errico I was about to post this as another possible solution.
추가 답변 (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!