how to run a function again and again till a condition satisfies?
조회 수: 3 (최근 30일)
이전 댓글 표시
Hello, i have a function which i want to run again and again till the condition is fulfilled.
please please help me....
댓글 수: 0
채택된 답변
Mischa Kim
2015년 4월 27일
suchismita, see e.g.,
flag = false;
cnt = 0;
while ~flag
cnt = cnt + 1;
fprintf('Try no.: %d\n', cnt);
if (rand() < 0.25)
flag = true;
end
end
Your function would simply reside inside the loop.
참고 항목
카테고리
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!