i have an .m file and i want know how interrupt command
window when program runs. So i want interrupt command window
to see some output and then i want that the running go on.
Can you help me?
In article <g1i4lo$nj0$1@fred.mathworks.com>,
Frank Pezzulo <john.doe.nospam@mathworks.com> wrote:
>i have an .m file and i want know how interrupt command
>window when program runs. So i want interrupt command window
>to see some output and then i want that the running go on.
>Can you help me?
Sorry, there is no "interrupt" mechanism, and there is no
way to program the result of what happens when you try to interrupt.
You will have to find another way.
If you want to suspend execution, examine something, and then
continue, then you will need to set a breakpoint. Breakpoints
*can* be set from within a program... if you know the right place
to set them! If you just want to suspend "where-ever the program
is now", you have a problem. But you -could-, for example, have
a GUI button which set a breakpoint at a known point in a loop.
Watch out, though, for changes to the code, as breakpoints are by
line number.
If you do not need quite as much suspension, then you could
use input() to create a space in which the program is pausing
waiting for permission to continue; while it is paused in this way,
you could use use the array browser to examine global variables.
You would not be able to examine local variables, though, and
you would have to have previously told the base workspace that the
variable was global.
--
"Tired minds don't plan well. Sleep first, plan later."
-- Walter Reisch
"Frank Pezzulo" <john.doe.nospam@mathworks.com> wrote in
message <g1i4lo$nj0$1@fred.mathworks.com>...
> Dear All,
>
> i have an .m file and i want know how interrupt command
> window when program runs. So i want interrupt command
window
> to see some output and then i want that the running go on.
> Can you help me?
>
> Thanks
>
> Francesco
Check out the DBLOOP function on the file exchange:
On May 28, 12:15=A0am, "Frank Pezzulo" <john.doe.nos...@mathworks.com>
wrote:
> Dear All,
>
> i have an .m file and i want know how interrupt command
> window when program runs. So i want interrupt command window
> to see some output and then i want that the running go on.
> Can you help me?
>
> Thanks
>
> Francesco
Hello Francesco.
I don't know if you already know, but as well as putting breakpoints
in the m file, which other people have described, you can write the
line:
keyboard
at any point in the m-file. Then when matlab runs the file and it
reaches that point control will return to the command line, which will
have a K>> prompt. You can examine all the variables and check that
the program is in the state you would expect. Then when you type
K>>return
at the command line it will run on, to the next keyboard or the end.
hth,
Bill Weston
>
> Hello Francesco.
>
> I don't know if you already know, but as well as putting
breakpoints
> in the m file, which other people have described, you can
write the
> line:
>
> keyboard
>
> at any point in the m-file. Then when matlab runs the
file and it
> reaches that point control will return to the command
line, which will
> have a K>> prompt. You can examine all the variables and
check that
> the program is in the state you would expect. Then when
you type
>
> K>>return
>
> at the command line it will run on, to the next keyboard
or the end.
> hth,
> Bill Weston
I have been using keyboard for a while and found it very
helpful. I recently changed computers and versions and even
though the command still works (interrupts the program and
has th K>> prompt) it does not take the cursor to the
keyboard command in the editor. The arrow still appears in
the editor, but I have to scroll to it. Wold anybody know
how to solve this??
>
> Hello Francesco.
>
> I don't know if you already know, but as well as putting
breakpoints
> in the m file, which other people have described, you can
write the
> line:
>
> keyboard
>
> at any point in the m-file. Then when matlab runs the
file and it
> reaches that point control will return to the command
line, which will
> have a K>> prompt. You can examine all the variables and
check that
> the program is in the state you would expect. Then when
you type
>
> K>>return
>
> at the command line it will run on, to the next keyboard
or the end.
> hth,
> Bill Weston
I have been using keyboard for a while and found it very
helpful. I recently changed computers and versions and even
though the command still works (interrupts the program and
has th K>> prompt) it does not take the cursor to the
keyboard command in the editor. The arrow still appears in
the editor, but I have to scroll to it. Wold anybody know
how to solve this??
Public Submission Policy
NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for
all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content.
Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available
via MATLAB Central. Read the complete Disclaimer prior to use.