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

조회 수: 7 (최근 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 CenterFile Exchange에서 Entering Commands에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by