Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
272 views
in Technique[技术] by (71.8m points)

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

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.

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?

question from:https://stackoverflow.com/questions/2633019/how-can-i-flush-the-output-of-disp-in-matlab-or-octave

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Use fflush(stdout) and/or fflush(stderr) to flush the buffer from disp().


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...