help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: octave & pipes


From: Thomas Ilnseher
Subject: Re: octave & pipes
Date: Wed, 16 Jul 2008 08:38:42 +0200

Am Dienstag, den 15.07.2008, 19:41 -0500 schrieb Anne Rogers:
> 
> 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", '-')
> 
> 
> 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
> 
> 
> However, the command "cat test.txt | octave -q r.m" appears 
> to hang.
> 
can't help you here
> 
> Do I need some magic to get octave to work with pipes?
> 
> 
> Second question:
> 
> 
> r.m is set to be executable, but if I try to run "./r.m < test.txt"
> I get what look like shell errors:
> 
> 
>   ./r.m < test.txt
>   ./r.m: line 2: syntax error near unexpected token `('
>   ./r.m: line 2: `tt = load("-ascii", '-')'

does your r.m file start with:
#!/usr/bin/octave -qf 

? (this needs to be the first line in the file).

that does work for me.
> 
> 
> From reading the bugs archive, I have the sense that this
> is a know bug, but just in case, am I doing something wrong?
> 
> 
> -Anne Rogers
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> _______________________________________________
> Help-octave mailing list
> address@hidden
> https://www.cae.wisc.edu/mailman/listinfo/help-octave
-- 
Thomas Ilnseher <address@hidden>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]