Printing Status from .m files

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Printing Status from .m files

Andy Adler-4
-----BEGIN PGP SIGNED MESSAGE-----

I'm in the process of converting .m files from Matlab to
octave. Most of the time I find I prefer the way octave does it,
when there's a difference, but sometimes I'd like the Matlab
behaviour.

When I have a long function, I often print status messages like
 Foobar: iteration 2 of 666 completed.

In matlab, these show on the screen immediately, but octave waits
until the control is returned to the user, making the status
messages useless.

My question is:

Is there any way to force octave to print the text immediately?

Thanks for any help.
_____________________________________________________________________
Andy Adler,    | Pulmonary Physiology Unit         | Lab 303-398-1626
[hidden email] | National Jewish Center,Denver,USA | Fax 303-398-1607

   For the Snark _was_ a Boojum, you see.    -Lewis Carroll

-----BEGIN PGP SIGNATURE-----
Version: 2.6.3a
Charset: noconv

iQCVAwUBNBBWExSHDFEuY1DZAQEYvwP+II5CC0B7e6FnppBxf+hLhYVYOtKX3TjW
+YsugJx/AvplMIIFKpziaaPVxfcpu5ysmBIlzcAKBvODbtOd6KZ4d6DQm42Z1Dny
OPuyjD1GGWQ83AZZ37BSHhc/Kbo5e2DlDgBQrO56skPF4Pe9x6eOmk4AipTqA7o5
Jkk+/0EQoFY=
=TjnO
-----END PGP SIGNATURE-----


Reply | Threaded
Open this post in threaded view
|

Re: Printing Status from .m files

Mario Storti-4
> I'm in the process of converting .m files from Matlab to
> octave. Most of the time I find I prefer the way octave does it,
> when there's a difference, but sometimes I'd like the Matlab
> behaviour.
>
> When I have a long function, I often print status messages like
>  Foobar: iteration 2 of 666 completed.
>
> In matlab, these show on the screen immediately, but octave waits
> until the control is returned to the user, making the status
> messages useless.
>
> My question is:
>
> Is there any way to force octave to print the text immediately?
>
> Thanks for any help.
> _____________________________________________________________________

Try the following. You may put it in the ".octaverc" file.

octave:> page_screen_output=0;

Mario

%%%%%%<>%%%%%%<>%%%%%%<>%%%%%%<>%%%%%%<>%%%%%%<>%%%%%%<>%%%%%
Mario Alberto Storti               | Fax: (54)(42) 55.09.44 |
Grupo de Tecnologia Mecanica       | Tel: (54)(42) 55.91.75 |
INTEC, Guemes 3450 - 3000 Santa Fe | Home: Gob. Vera 3161   |
Argentina                          |       (54)(42) 55.00.23|
Reply: [hidden email]  |                        |
                http://venus.unl.edu.ar/gtm-eng.html        |


Reply | Threaded
Open this post in threaded view
|

Re: Printing Status from .m files

JIANG MING
In reply to this post by Andy Adler-4

use fflush(stdout);



On Fri, 5 Sep 1997, Andy Adler wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
>
> I'm in the process of converting .m files from Matlab to
> octave. Most of the time I find I prefer the way octave does it,
> when there's a difference, but sometimes I'd like the Matlab
> behaviour.
>
> When I have a long function, I often print status messages like
>  Foobar: iteration 2 of 666 completed.
>
> In matlab, these show on the screen immediately, but octave waits
> until the control is returned to the user, making the status
> messages useless.
>
> My question is:
>
> Is there any way to force octave to print the text immediately?
>
> Thanks for any help.
> _____________________________________________________________________
> Andy Adler,    | Pulmonary Physiology Unit         | Lab 303-398-1626
> [hidden email] | National Jewish Center,Denver,USA | Fax 303-398-1607
>
>    For the Snark _was_ a Boojum, you see.    -Lewis Carroll
>
> -----BEGIN PGP SIGNATURE-----
> Version: 2.6.3a
> Charset: noconv
>
> iQCVAwUBNBBWExSHDFEuY1DZAQEYvwP+II5CC0B7e6FnppBxf+hLhYVYOtKX3TjW
> +YsugJx/AvplMIIFKpziaaPVxfcpu5ysmBIlzcAKBvODbtOd6KZ4d6DQm42Z1Dny
> OPuyjD1GGWQ83AZZ37BSHhc/Kbo5e2DlDgBQrO56skPF4Pe9x6eOmk4AipTqA7o5
> Jkk+/0EQoFY=
> =TjnO
> -----END PGP SIGNATURE-----
>


Reply | Threaded
Open this post in threaded view
|

Re: Printing Status from .m files

John Logsdon-4
In reply to this post by Andy Adler-4


On Fri, 5 Sep 1997, Andy Adler wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
>
> I'm in the process of converting .m files from Matlab to
> octave. Most of the time I find I prefer the way octave does it,
> when there's a difference, but sometimes I'd like the Matlab
> behaviour.
>
> When I have a long function, I often print status messages like
>  Foobar: iteration 2 of 666 completed.
>
> In matlab, these show on the screen immediately, but octave waits
> until the control is returned to the user, making the status
> messages useless.
>
> My question is:
>
> Is there any way to force octave to print the text immediately?
>
Andy

The best way I do this in Octave is (a) set page_screen_output=0 as
already suggested and (b) to use sprintf with no semi-colon on
the end.  This way you can format your output and it goes straight to the
console.

Good luck

John