필터 지우기
필터 지우기

disp() output to command line significantly delayed, not right in time relative to the further program progress?

조회 수: 11 (최근 30일)
My program cycles through some loops, and for each turn I want to print a line telling me which cycle of the loop I am processing right now, thus writing some kind of progress information to the command line. But it appears as if the lines are not written to the command line successively in time when calling the disp() function, but as if the lines become all printed together in a block of lines once all looping has finished.
I have the feeling, that this behaviour also appears in other ocasions, and not only in loop processing, that MATLAB in general produces delays in the command line output, that the command line output is not synchronous with the program progress.
Is there any way to force the line output to become written to the command line when called, before any new part of the program is subsequently processed?

채택된 답변

Jacob Halbrooks
Jacob Halbrooks 2014년 2월 25일
I would first suggest trying FPRINTF in place of DISP to see if that produces different behavior. Here is an example call:
fprintf('Disp at command line\n')
If the display is still delayed, consider inserting a DRAWNOW call after displaying the text to force MATLAB to update. Another common function used to force MATLAB to update is PAUSE.
  댓글 수: 1
Marco
Marco 2014년 2월 25일
Thanks!!!! It works.
I didn´t see any difference from changing between the disp() function and the fprintf() function, though. But the DRAWNOW call solved my problem perfectly! Haven´t know about that call before. So, thanks again!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by