Thread Subject: Simple Problem - Command Prompt

Subject: Simple Problem - Command Prompt

From: Ahmad

Date: 3 Nov, 2009 19:16:05

Message: 1 of 5

The problem is that when a final result is obtained the comand prompt closes immediately and I can't se the result. What command can I use so that command prompt doesn't close after the calculations?

Subject: Simple Problem - Command Prompt

From: jrenfree

Date: 3 Nov, 2009 20:56:37

Message: 2 of 5

On Nov 3, 11:16 am, "Ahmad " <climbe...@gmail.com> wrote:
> The problem is that when a final result is obtained the comand prompt closes immediately and I can't se the result. What command can I use so that command prompt doesn't close after the calculations?

What do you mean the command prompt closes? Does Matlab completely
shut down? By command prompt do you mean the Command Window?

Subject: Simple Problem - Command Prompt

From: Ahmad

Date: 4 Nov, 2009 12:03:02

Message: 3 of 5

I mean th command prompt which opens in which the code is executed when the exe is created from the m-file. I mean the command prompt environment in which the exe opens. Once it computes the results it closes immediately! How should I make it remain open?

Subject: Simple Problem - Command Prompt

From: ImageAnalyst

Date: 4 Nov, 2009 13:48:01

Message: 4 of 5

On Nov 4, 7:03 am, "Ahmad " <climbe...@gmail.com> wrote:
> I mean th command prompt which opens in which the code is executed when the exe is created from the m-file. I mean the command prompt environment in which the exe opens. Once it computes the results it closes immediately! How should I make it remain open?

------------------------------------------------------------------------------------------------------------------------------------
You need to open a command window and run your exe from there. If you
just double click the icon, it will open the command window briefly,
crash and dump the error message to it, and then (unfortunately) shut
down that window. This is what you're experiencing.

If you open a separate command window manually (say with Start/Run/cmd
in Windows XP), change directory to the folder, and run the program,
the window won't shut down and any error messages will remain in view.

Or alternatively run it from the command window panel in MATLAB with
the ! operator, like this:
!myapp
Then the error messages will remain in the MATLAB command window.

Subject: Simple Problem - Command Prompt

From: Steven Lord

Date: 4 Nov, 2009 14:18:19

Message: 5 of 5


"ImageAnalyst" <imageanalyst@mailinator.com> wrote in message
news:398467f9-9532-4eee-9959-a00cd35e2836@r5g2000yqb.googlegroups.com...
> On Nov 4, 7:03 am, "Ahmad " <climbe...@gmail.com> wrote:
> > I mean th command prompt which opens in which the code is executed when
> > the exe is created from the m-file. I mean the command prompt
> environment in which the exe opens. Once it computes the results it closes
> immediately! How should I make it remain open?
>
> ------------------------------------------------------------------------------------------------------------------------------------
> You need to open a command window and run your exe from there. If you
> just double click the icon, it will open the command window briefly,
> crash and dump the error message to it, and then (unfortunately) shut
> down that window. This is what you're experiencing.

I don't think there's any crash involved.

When you run a function in MATLAB, once the function has finished executing,
you return to the command prompt.
When you run a function in a compiled application, once the function has
finished executing, the compiled application exits. As part of the process
of exiting, the application must close down any windows it created.

> If you open a separate command window manually (say with Start/Run/cmd
> in Windows XP), change directory to the folder, and run the program,
> the window won't shut down and any error messages will remain in view.
>
> Or alternatively run it from the command window panel in MATLAB with
> the ! operator, like this:
> !myapp
> Then the error messages will remain in the MATLAB command window.

Those are two options; alternately, use UIWAIT on the handle of a MSGBOX so
that the function doesn't finish executing until the dialog is closed.

--
Steve Lord
slord@mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

rssFeed for this Thread

Contact us at files@mathworks.com