필터 지우기
필터 지우기

stop, record and continue a loop function

조회 수: 1 (최근 30일)
Fadzli
Fadzli 2017년 5월 22일
댓글: Fadzli 2017년 5월 26일
Hi,
I have problem in running a for loop function. Let say I'm running 5 loop function, but at 3rd loop, there was an error and I have to stop it manually (press Ctrl+C). Then unfortunately all the previous 2 results were gone. So how can I stop the function without missing the results and at the same time, automatically continue to the next loop? Thanks
  댓글 수: 2
Stephen23
Stephen23 2017년 5월 22일
@Fadzli: Some options:
  • save intermediate data
  • use try and catch to avoid errors
  • write code to be robust for all known cases, incl. edge-cases.
  • record and re-run failed cases only.
  • ...
What you use depends on your data and your workflow.
Fadzli
Fadzli 2017년 5월 26일
Thanks @Stephen Cobeldick, Will try to look for the best option on my case. Also looking for 'break' function whether it is suitable to be used in my case.

댓글을 달려면 로그인하십시오.

채택된 답변

KSSV
KSSV 2017년 5월 22일
Check try and Catch
  댓글 수: 1
Fadzli
Fadzli 2017년 5월 26일
Thanks @KSSV, will try to use that function. But any details on how to use it is really appreciated...

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

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