필터 지우기
필터 지우기

Skipping part of an index in a for-loop

조회 수: 13 (최근 30일)
Robert Mason
Robert Mason 2016년 7월 31일
답변: dpb 2016년 7월 31일
I have a set of data and a for-loop, for instance:
d(1) = 1;
d(2) = 2;
d(3) = 3;
for j= [1 3];
g = d(3)./(d + d(3));
end;
I would like the for-loop to skip one of the numbers in the index (for instance, 2). How can I go about coding this up?

답변 (1개)

dpb
dpb 2016년 7월 31일
nDont=2;
for j...
if j==nDont, continue, end
...
doc continue % for details

카테고리

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