How to pause the code?

103 visualizaciones (últimos 30 días)
QiQin Zhan
QiQin Zhan el 3 de Mzo. de 2013
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.

Respuesta aceptada

Brian B
Brian B el 3 de Mzo. de 2013
Editada: Brian B el 3 de Mzo. de 2013
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 comentarios
QiQin Zhan
QiQin Zhan el 3 de Mzo. de 2013
Great job! You just solve my question.
Brian B
Brian B el 3 de Mzo. de 2013
Cool. Glad it helped.

Iniciar sesión para comentar.

Más respuestas (1)

Youssef  Khmou
Youssef Khmou el 3 de Mzo. de 2013
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 comentarios
Youssef  Khmou
Youssef Khmou el 3 de Mzo. de 2013
both of them work,
Brian B
Brian B el 3 de Mzo. de 2013
True. I didn't read it carefully, and thought you wrote "... until you press return".

Iniciar sesión para comentar.

Categorías

Más información sobre Desktop en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by