Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

how to redirect Matlab console output

1,268 views
Skip to first unread message

champion

unread,
Dec 1, 2009, 12:31:42 PM12/1/09
to
Hello,

For my final project I am doing some actions within a GUI. My GUI has
three panels and in one of these panels I would like to show the
console output.
It means that, I want to have a component like static text field(or
something similar) in one of the panels in the GUI and then show the
Matlab console output in that static text field.

For instance, when you run a Matlab code, the result will be printed
in the Matlab console, so I want to re-direct this output into my
static text filed within my GUI panel.

does anyone know how to do this...I really appreciate your help.

- Hamid

Steven Lord

unread,
Dec 1, 2009, 12:45:25 PM12/1/09
to

"champion" <kalanta...@gmail.com> wrote in message
news:b69635e3-4f46-4ffb...@j14g2000yqm.googlegroups.com...

HELP EVALC.

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


Nate

unread,
Dec 14, 2010, 1:35:36 PM12/14/10
to
I have a similar problem, except that I want to dynamically display text while a stand-alone application is running (from a system() call). I'm using this as a way to show progress. Is there a way to either redirect stdout to a GUI object, or else pipe ( | ) the output to a GUI object as part of the system call?

The command executes as: system('compiled_application [args]'), with a bunch of print statements compiled in.

My understanding of evalc is that it will only return the output after the command has finished executing, which isn't helpful.

Nate W.

Walter Roberson

unread,
Dec 14, 2010, 3:47:06 PM12/14/10
to
"Nate " <the_z...@yahoo.com> wrote in message <ie8ddo$k5o$1...@fred.mathworks.com>...

> I have a similar problem, except that I want to dynamically display text while a stand-alone application is running (from a system() call). I'm using this as a way to show progress. Is there a way to either redirect stdout to a GUI object, or else pipe ( | ) the output to a GUI object as part of the system call?
>
> The command executes as: system('compiled_application [args]'), with a bunch of print statements compiled in.
>
> My understanding of evalc is that it will only return the output after the command has finished executing, which isn't helpful.

If you are on a unix-like system, you could redirect output to a named pipe and open that pipe in the GUI as a file. Note that you would be at the mercy of when the application decided to flush its output buffer.

On MS Windows, XP SP2 or later should in theory have equivalent functionality, but I haven't tested that and I don't know how to create named pipes in Windows.

Redirecting output to a file would also be fine on unix-type systems, as long as the GUI knew and worked with the fact that EOF would only mean "got to the end of what is in the file so far" rather than "the process is finished writing and there isn't anything else to come".

Redirecting output to a file on an MS Windows system has the practical problem that Windows complains when you attempt to open a file that is open for writing in a different process. I don't understand why Windows does that, since XP SP2 and later claim to be POSIX compliant and that behaviour is not POSIX compliant, but it is a fact of life on Windows. There are apparently Windows programs to "unlock" files even when they are in use.

xob...@gmail.com

unread,
Apr 30, 2016, 7:23:49 AM4/30/16
to
I want to display the results shown in command window by clicking push button. I mean, I created a function and when I run that function the results are shown in matlab command window. Now I am making an interface with matlab gui and want to show that result in a textbox by clicking push button. For that i call this function in gui but getting results in command window . How can i redirect results from command window to GUI textbox? Results containing numbers as well as words (about 5 lines). can anyone help
0 new messages