问题描述
我在Octave中有一个带循环的程序-运行具有各种参数的函数,而不是可以转换为矩阵的函数.在每次迭代的开始,我使用disp
打印当前参数.
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 print the current parameters using disp
.
我第一次运行它时,我有一个 /a>警告,然后我也得到了这些打印件.现在,我清理了它们,再也看不到它们了.我的猜测是它们卡在缓冲区中,程序结束或缓冲区满时我会看到它们.
The first times I ran it I had a brazillion warnings, and then I also got these prints. Now that I cleaned them up, I no longer see them. My guess is that they're stuck in a buffer, and I'll see them when the program ends or the buffer fills.
有什么方法可以强制清空打印缓冲区,以便我可以看到我的打印品吗?
Is there any way to force a flush of the print buffer so that I can see my prints?
推荐答案
使用fflush(stdout)和/或fflush(stderr)从disp()刷新缓冲区.
Use fflush(stdout) and/or fflush(stderr) to flush the buffer from disp().
这篇关于如何在Matlab或Octave中刷新disp的输出?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!