calling system(command, '-echo') prints a new line for every update in progress bar

7 views (last 30 days)
I'm calling a python script that uses keras API which in turn calls tensfor flow functions. During the execution of the script, python prints out a progress bar. When the script is called from command window, it runs perfectly well but when I call it from matlab using 'system( command, '-echo')' the progress bar is printed in a new line every time an update happens instead of updating the same line.
Here is a snippet from the outout I get:
15744/531300 [..............................] - ETA: 33s
16480/531300 [..............................] - ETA: 33s
17376/531300 [..............................] - ETA: 33s
18304/531300 [>.............................] - ETA: 33s
19168/531300 [>.............................] - ETA: 33s
20064/531300 [>.............................] - ETA: 32s
21024/531300 [>.............................] - ETA: 32s
When I call system() without '-echo' nothing is printed out live but everything gets printed when the whole code stops execution which makes the progress bar pointless (since I don't see live updates).
I need to get the progress bar to be printed and updated on the same line instead of getting a new line for every update. Can someone help me fix that?
Thanks.
  3 Comments
Yahia Shabara
Yahia Shabara on 18 Mar 2019
My question is how to make the progress bar printed out on one line like it would normally do when the script is called from windows command window.
Jan
Jan on 19 Mar 2019
You can't. The backspace characters needed for this do not work, when a linebreak was submitted before. For a long time backspace characters did not work in Matlab's command window under Windows, such that these progress indication was working under Linux only, but I didn't test this in the last years.
I assume, you cannot fix the display of a progressbar, which is created through the text output of an external function.

Sign in to comment.

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!