octave & pipes

Ben Abbott bpabbott at mac.com
Wed Jul 16 07:47:05 CDT 2008


On Jul 15, 2008, at 8:41 PM, Anne Rogers wrote:

>
> I am just learning octave.  I am using version 3.0.1 on a mac running
> leopard.
>
> I have two questions.
>
> Here's a script called r.m.
>
>   #! /Applications/Octave.app/Contents/Resources/bin/octave -q -f
>   tt = load("-ascii", '-')

Is this intended to be a shell script or an octave script?

> and a file test.txt:
>
>    0.020000   0.920000   0.020000   0.020000   0.020000
>    0.020000   0.020000   0.380000   0.380000   0.200000
>    0.020000   0.020000   0.020000   0.920000   0.020000
>    0.920000   0.020000   0.020000   0.020000   0.020000
>    0.470000   0.020000   0.470000   0.020000   0.020000
>
>
> If I run it using the command "octave -q r.m < test.txt," I get the
> expected result:
>
> octave -q r.m < test.txt
> tt =
>
>    0.020000   0.920000   0.020000   0.020000   0.020000
>    0.020000   0.020000   0.380000   0.380000   0.200000
>    0.020000   0.020000   0.020000   0.920000   0.020000
>    0.920000   0.020000   0.020000   0.020000   0.020000
>    0.470000   0.020000   0.470000   0.020000   0.020000


I don't think that is what is usually expected. Entering the contents  
of your test.txt file at the octave prompt will produce syntax errors.

Try "/Applications/Octave.app/Contents/Resources/bin/octave <  
test.txt" to see what I'd expect.

> However, the command "cat test.txt | octave -q r.m" appears
> to hang.

What is it you're expecting octave to do with "text.txt"?





More information about the Help-octave mailing list