For with Break
조회 수: 1 (최근 30일)
이전 댓글 표시
Hi all.Please Help me.
How I can use for with break. "
for i=1:n;
%action
if H == 1 ; break
end
end
채택된 답변
Teja Muppirala
2011년 5월 7일
Seems like you've got the right idea:
for n=1:100
disp(n)
if n == 7
disp('Hello everybody')
break
end
end
댓글 수: 2
Teja Muppirala
2011년 5월 7일
One more example:
n = 100;
for k=1:n
k
H = k^2;
if H == 36
disp('H is now 36. I will stop')
break
end
end
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Startup and Shutdown에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!