[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Please help me on how to redirect my output from console to a text f
Jordi Gutiérrez Hermoso
Re: Please help me on how to redirect my output from console to a text file
Wed, 13 Feb 2008 08:25:26 -0600
On 13/02/2008, vikash kumar <address@hidden> wrote:
> I have recently started using GNU-Octave...I tried to run a matlab
> script on
> it and got the output on the console..
> But I want to redirect this output to say a taxt file...
If you're using a Unix-like shell (e.g. bash), you can type the
following command at the shell:
octave -q --eval `cat yourscript.m` > your-output-file
A slightly more elegant way is to make your script executable. You can
do this by putting the line "#!/path/to/octave -q" on a line by itself
at the beginning of your script (in an apt-based distro,
/path/to/octave usually is /usr/bin/octave, and if you built Octave
yourself it may be /usr/local/bin/octave"). You also need to set
executable permissions on the script. Do "chmod +x yourscript.m". Then
you can type at a shell prompt
yourscript.m > your-output-file
I'm sure you can do something very similar to the first option I gave
you if you don't have a Unix-like shell available, but the second
option definitely demands a Unix-like OS.
- Jordi G. H.