View Full Version : Display result in loop while Octave is running
in_flu_ence
January 24th, 2008, 06:54 AM
Hi,
I am running a long octave code and am trying to troubleshoot it. I have placed some disp () functions in a while loop but it becomes a blank page when I start running the code. I can only see the disp stuff after the code is finished. It works in Matlab but not in octave. Any advice?
Thanks
artesian_spring
January 24th, 2008, 10:07 AM
I've had the same experience. It seems like octave waits until a script (or at least a loop) is finished before printing everything generated by the script/loop.
If anyone knows a way around this, I'd be interested in learning it, too.
in_flu_ence
January 24th, 2008, 01:26 PM
Has anyone tried octave 3.0 and wonder if this is resolved?
I am currently using octave 2.9 + forge.
It is actually quite annoying that I can't troubleshoot when results start to diverge without knowing.
yingyang116
March 4th, 2008, 03:19 PM
I am using Octave 3.0 and encountered the same problem.
thisismalhotra
March 4th, 2008, 05:54 PM
Hi,
I am running a long octave code and am trying to troubleshoot it. I have placed some disp () functions in a while loop but it becomes a blank page when I start running the code. I can only see the disp stuff after the code is finished. It works in Matlab but not in octave. Any advice?
Thanks
I think what you need to use is a printf command and not disp
().
I use that all the time to display my loop results .. byt the way I use octave 3.0.
In case you need to upgrade you can get deb's from here
http://ubuntuforums.org/showthread.php?t=713880
Let me if it works for you/or NOT:KS
vueltaconicarus
May 15th, 2008, 06:27 AM
Hi!
I use Octave 3.01 and had the same problem. But I found a way 'round it:
Taken from http://www.delorie.com/gnu/docs/octave/octave_100.html:
Built-in Function: fflush (fid)
Flush output to fid. This is useful for ensuring that all pending output makes it to the screen before some other event occurs.
So the code
printf('Whatever');
fflush(stdout);
will produce screen outputs even inside loops, without waiting for the loop to finish.
Best regards
gustavx
February 23rd, 2009, 08:50 PM
You can turn the paging off with:
more off;
I'm sure this will work.
wblack
June 29th, 2010, 01:55 PM
Hi!
I use Octave 3.01 and had the same problem. But I found a way 'round it:
Taken from http://www.delorie.com/gnu/docs/octave/octave_100.html:
Built-in Function: fflush (fid)
Flush output to fid. This is useful for ensuring that all pending output makes it to the screen before some other event occurs.
So the code
printf('Whatever');
fflush(stdout);
will produce screen outputs even inside loops, without waiting for the loop to finish.
Best regards
Thanks for the tip vueltaconicarus. I used disp instead of printf and it works also. Disp automatically attaches a newline at the end so it is easier to read the output.
disp("Whatever");
fflush(stdout);
aksehirlim
October 12th, 2010, 03:53 AM
You can turn the paging off with:
more off;
I'm sure this will work.
This worked for me. Thanks.
tzjin anthony ks
October 12th, 2010, 10:48 PM
I have two lines in my .octaverc file (which you could add to the beginning of your code):
page_screen_output(0);
page_output_immediately(1);
vBulletin® v3.8.7, Copyright ©2000-2012, vBulletin Solutions, Inc.