How can I flush the output of disp in Matlab or Octave?

后端 未结 7 525
借酒劲吻你
借酒劲吻你 2020-12-29 03:20

I have a program in Octave that has a loop - running a function with various parameters, not something that I can turn into matrices. At the beginning of each iteration I p

7条回答
  •  被撕碎了的回忆
    2020-12-29 03:37

    As mentioned by moastab, fflush(stdout) works for Octave.

    In MATLAB, use drawnow('update') to flush the output.

    MATLAB's drawnow function will be familiar to those who control the redrawing of graphical objects in MATLAB, but it applies to the stdout stderr buffers as well. The 'update' option is not required, but limits the flushing to non-graphical queues. This detail is merely implied in the drawnow() documentation; I have verified it to work on fprintf calls in a loop.

提交回复
热议问题