How much time does it take for matlab to print a line in the command window
27 views (last 30 days)
Show older comments
Hi,
I have a function that prints a line in the command window every time it is run. This function is run for a different number of times depending on the situation, but at maximum like 3000 times. This is why I wonder how much time it takes for matlab to actually write the line in excess of the time it takes to run the command. I Expect this operation to slow down my script quite a lot. This is a little hard to test since the program runs on a multi core processor and thus the cpu time is higher than the actual time passing. Also tic-toc does not take care to the delay due to printing.
If anyone anything about this please respond.
BR Patrik
0 Comments
Accepted Answer
Jan
on 20 Dec 2013
The updates of the command window are performed in the Java level of Matlab. The execution times vary randomly and can slow down the processing remarkably.
I ran a large program with several hundred thousands line of code, which needs some seconds to execute only. When I have to start in in a batch mode for thousands of cases, the delay caused by the screen output is painful and therefore I've implemented a "fast" mode, which calls the program through evalc() and suppressed the complete output except for warning or errors. This saves 20% to 30% runtime(!) and nobody is able to read 1000*500 lines of messages at all.
0 Comments
More Answers (0)
See Also
Categories
Find more on Startup and Shutdown in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!