|
"Walter Roberson" <roberson@hushmail.com> wrote in message
news:R0mol.15634$i42.10835@newsfe17.iad...
> Diego Zegarra wrote:
>
>> If I am running a .m file, is there anyway I can pause it whenever I
>> want?
>
> Sorry, no, there is not. The core matlab routines omit checks for
> potential
> interruptions for performance reasons, so it is not possible to check
> at completely arbitrary times. Depending on what is being done, it can
> take
> seconds or minutes or even hours before Matlab is ready to check to see
> if something else should be done.
>
>>I know that when you are debugging you can just put a break point and it
>>will always stop
>>there, thats the thing, I want to stop it when I want to, not at every
>>iteration.
>
> Would a conditional breakpoint be a possible solution? e.g., one way
> of doing it would be to define a global variable, and have a uicontrol
> which sets the global variable non-zero when you click it; the
> conditional breakpoint could then be checking to see whether the global
> was non-zero.
A conditional breakpoint is one way to do this. Another way, if you know
the conditions under which you want it to stop ahead of time, and you always
want to stop at a particular location if the conditions are satisfied, is to
insert an IF statement that checks the condition at that location and use
the KEYBOARD statement inside the IF block. This does require a code change
(unlike conditional breakpoints) but unlike breakpoints, the KEYBOARD
statement isn't removed by CLEAR.
--
Steve Lord
slord@mathworks.com
|