How to pause the code?

조회 수: 157 (최근 30일)
QiQin Zhan
QiQin Zhan 2013년 3월 3일
We can use 'Pause'function to pause what's running(e.g in a for loop).If we want to continue,we can just press the keyboard.Then my question is whether there is a way or another similar function which we can set a flag to pause or to continue.

채택된 답변

Brian B
Brian B 2013년 3월 3일
편집: Brian B 2013년 3월 3일
If you only want to pause when specific conditions are satisfied, you can put the pause or keyboard statement inside an if clause.
Another option is to use conditional breakpoints. See http://blogs.mathworks.com/community/2010/08/09/debugging-points/.
  댓글 수: 9
QiQin Zhan
QiQin Zhan 2013년 3월 3일
Great job! You just solve my question.
Brian B
Brian B 2013년 3월 3일
Cool. Glad it helped.

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

추가 답변 (1개)

Youssef  Khmou
Youssef Khmou 2013년 3월 3일
hi Chan,
you can use the function " keyboard" :
doc keyboard;
When you insert the function in function/script , it stops until you type return .
  댓글 수: 3
Youssef  Khmou
Youssef Khmou 2013년 3월 3일
both of them work,
Brian B
Brian B 2013년 3월 3일
True. I didn't read it carefully, and thought you wrote "... until you press return".

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

카테고리

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