How to pause the code?

114 次查看(过去 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 中查找有关 Desktop 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by