From: Federico Miorelli on
Hi All,

I have a Matlab script which calls an executable for some computations that take quite a long time to complete.
The program prints progress messages to stdout, I'd like to show a progress bar which updates by parsing these messages.

Is there a way to attach to the stdout of the program from Matlab?

system('the_command') is a blocking call, so I get all the output in a string at the end
system('the_command &') is asynchronous and I get a DOS window which Matlab doesn't wait for.

Thanks and best regards,
Federico
From: dpb on
Federico Miorelli wrote:
> Hi All,
>
> I have a Matlab script which calls an executable for some computations
> that take quite a long time to complete.
> The program prints progress messages to stdout, I'd like to show a
> progress bar which updates by parsing these messages.
>
> Is there a way to attach to the stdout of the program from Matlab?
>
> system('the_command') is a blocking call, so I get all the output in a
> string at the end
> system('the_command &') is asynchronous and I get a DOS window which
> Matlab doesn't wait for.
....

Directly, I don't think so.

You might try redirecting the STDOUT to a file and see if you can
periodically read it to retrieve the data therein.

--
From: Walter Roberson on
Federico Miorelli wrote:

> I have a Matlab script which calls an executable for some computations
> that take quite a long time to complete.
> The program prints progress messages to stdout, I'd like to show a
> progress bar which updates by parsing these messages.
>
> Is there a way to attach to the stdout of the program from Matlab?
>
> system('the_command') is a blocking call, so I get all the output in a
> string at the end
> system('the_command &') is asynchronous and I get a DOS window which
> Matlab doesn't wait for.

Matlab does not supply a mechanism for this.

I describe using popen() in
http://www.mathworks.com/matlabcentral/newsreader/view_thread/271391

Windows XP SP2 and later should (in theory) support popen() directly, as they
incorporate POSIX support. In previous Windows versions you could use _popen
http://msdn.microsoft.com/en-us/library/aa298534%28VS.60%29.aspx