How much time does it take for matlab to print a line in the command window

27 ビュー (過去 30 日間)
Patrik Ek
Patrik Ek 2013 年 12 月 20 日
回答済み: Jan 2013 年 12 月 20 日
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

採用された回答

Jan
Jan 2013 年 12 月 20 日
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 件)

カテゴリ

Help Center および File ExchangeStartup and Shutdown についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by