Get return values from cmd line 'live'
Mostrar comentarios más antiguos
Hello everybody; i've got a little problem with my matlab-Code. I'm calling a external program, which converts mf4-data to *.mat files, by using the system command. Unfortunately it takes a lot of time, so I decided to use something like a waitbar, to show the progress to the user. The converting programm it self, showing a progress in percentage, if it is running directly in cmd-window. If I start it by Matlab, only at the end matlab shows me something like a summary, where all values in. I tried using the '!' operator as well as the system command. Is there a possibility, that you get the values in 'livetime'. So to say at the moment they appear in the cmd line?
Thanks a lot for helping and a have a pleasant weekend!
Greeting Dominik Sieb
Respuestas (2)
dpb
el 24 de Nov. de 2017
1 voto
" Is there a possibility, that you get the values in 'livetime'."
Short answer, "no". Not from the system command route; it buffers the output internally until the detached process terminates.
You might be able to redirect the output of the process to a file instead of console and read it periodically from the Matlab session...no guarantees on whether is even possible nor how it might/might not work if can even open the file with synchronization issues, etc., ...
1 comentario
Dominik Sieb
el 27 de Nov. de 2017
Walter Roberson
el 27 de Nov. de 2017
1 voto
In theory it would be possible to adapt the popen code there for MS Windows by changing to _popen() but it might take a bit of fiddling.
If you look at the comments of the popen contribution, someone has posted the java equivalent there, which should be usable with Windows as well.
For MS Windows it is also possible to use .NET to start processes. See https://blogs.mathworks.com/loren/2010/12/07/using-microsoft-net-to-expand-matlab-capabilities/
Categorías
Más información sobre Workspace Variables and MAT Files en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!