enabling immediate output behavior

View: New views
7 Messages — Rating Filter:   Alert me  

enabling immediate output behavior

by Aditya Bhagwat :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Dear all,

Consider following toy example:

    a=0;
    for i=1:5000
    a=a+1
    end
    a;


When I run this loop in octave, no output is sent to the terminal till
the very last function evaluation has been performed. This is ok for a
small script, but for large and time-consuming scripts it is really
necessary that you can follow what's going on.

I tried enabling immediate output by following means, but all failed:
* page_output_immediately(1)
* more off
* fflush(stdout)

Does anyone of you know a way to enable the immediate output behavior?
I am working with octave 3.2.3, within emacs.

Many thanks,

Aditya

_______________________________________________
Help-octave mailing list
Help-octave@...
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave

Re: enabling immediate output behavior

by Aditya Bhagwat :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Dear all,

I found one solution to circumvent the problem: not running octave from
within emacs, but from an independent (ubuntu) shell. There the 'more
off' command does work.

Regards,

Aditya

> Consider following toy example:
>
>    a=0;
>    for i=1:5000
>    a=a+1
>    end
>    a;
>
>
> When I run this loop in octave, no output is sent to the terminal till
> the very last function evaluation has been performed. This is ok for a
> small script, but for large and time-consuming scripts it is really
> necessary that you can follow what's going on.
>
> I tried enabling immediate output by following means, but all failed:
> * page_output_immediately(1)
> * more off
> * fflush(stdout)
>
> Does anyone of you know a way to enable the immediate output behavior?
> I am working with octave 3.2.3, within emacs.
>
> Many thanks,
>
> Aditya
>
>

_______________________________________________
Help-octave mailing list
Help-octave@...
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave

Re: enabling immediate output behavior

by Francesco Potortì :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

>    a=0;
>    for i=1:5000
>    a=a+1
>    end
>    a;
>
>
>When I run this loop in octave, no output is sent to the terminal till
>the very last function evaluation has been performed.

Try this one:

    a=0; for i=1:5000
    a=a+1; disp (a);
    endfor

It will output 5000 lines showing the values assigned to a.

--
Francesco Potortì (ricercatore)        Voice: +39 050 315 3058 (op.2111)
ISTI - Area della ricerca CNR          Fax:   +39 050 315 2040
via G. Moruzzi 1, I-56124 Pisa         Email: Potorti@...
(entrance 20, 1st floor, room C71)     Web:   http://fly.isti.cnr.it/
_______________________________________________
Help-octave mailing list
Help-octave@...
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave

Re: enabling immediate output behavior

by Aditya Bhagwat :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Dear Francesco,

Thanks for your help. Even while using disp(a) as you suggested, in the
Emacs editor's inferior octave process, all output is kept till the last
function evaluation has been performed, and only then sent to the
screen. But luckily, the problem is not present when executing octave
from my (ubuntu) bash terminal.

Regards,

Adi

>>    a=0;
>>    for i=1:5000
>>    a=a+1
>>    end
>>    a;
>>
>>
>> When I run this loop in octave, no output is sent to the terminal till
>> the very last function evaluation has been performed.
>>    
>
> Try this one:
>
>     a=0; for i=1:5000
>     a=a+1; disp (a);
>     endfor
>
> It will output 5000 lines showing the values assigned to a.
>
>  

_______________________________________________
Help-octave mailing list
Help-octave@...
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave

Re: enabling immediate output behavior

by Francesco Potortì :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

>Thanks for your help. Even while using disp(a) as you suggested, in the
>Emacs editor's inferior octave process, all output is kept till the last
>function evaluation has been performed, and only then sent to the
>screen.

Hm.  I run octave as an Emacs inferior process, though in a different
op.sys. (Debian).  If I run this:

octave> for i=1:50000 i=i+1; if (mod(i,10000)==0) disp(i); endif; endfor

I get this:

 10000
 20000
 30000
 40000
 50000
octave>

where the lines are printed at intervals of about one second's time.
Would you try my example above and let us know what happens?

--
Francesco Potortì (ricercatore)        Voice: +39 050 315 3058 (op.2111)
ISTI - Area della ricerca CNR          Fax:   +39 050 315 2040
via G. Moruzzi 1, I-56124 Pisa         Email: Potorti@...
(entrance 20, 1st floor, room C71)     Web:   http://fly.isti.cnr.it/
_______________________________________________
Help-octave mailing list
Help-octave@...
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave

Re: enabling immediate output behavior

by Aditya Bhagwat :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Dear Francesco,

Thanks for your involvement.

>> Thanks for your help. Even while using disp(a) as you suggested, in the
>> Emacs editor's inferior octave process, all output is kept till the last
>> function evaluation has been performed, and only then sent to the
>> screen.
>>    
>
> Hm.  I run octave as an Emacs inferior process, though in a different
> op.sys. (Debian).  If I run this:
>
> octave> for i=1:50000 i=i+1; if (mod(i,10000)==0) disp(i); endif; endfor
>
> I get this:
>
>  10000
>  20000
>  30000
>  40000
>  50000
> octave>
>
> where the lines are printed at intervals of about one second's time.
> Would you try my example above and let us know what happens?
>  

In my case, for a couple of seconds, nothing happens. Then, the lines
are printed all at once in the inferior octave window. I am working on
emacs 23.1, which I compiled on Ubuntu 9.04.

Regards,

Aditya

_______________________________________________
Help-octave mailing list
Help-octave@...
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave

Re: enabling immediate output behavior

by Francesco Potortì :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

>In my case, for a couple of seconds, nothing happens. Then, the lines
>are printed all at once in the inferior octave window. I am working on
>emacs 23.1, which I compiled on Ubuntu 9.04.

Allright, try this:

octave> more off
octave> for i=1:20000 i=i+1; if (mod(i,4000)==0) disp(i); endif; endfor

And look at what happens

--
Francesco Potortì (ricercatore)        Voice: +39 050 315 3058 (op.2111)
ISTI - Area della ricerca CNR          Fax:   +39 050 315 2040
via G. Moruzzi 1, I-56124 Pisa         Email: Potorti@...
(entrance 20, 1st floor, room C71)     Web:   http://fly.isti.cnr.it/
_______________________________________________
Help-octave mailing list
Help-octave@...
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave