help-octave
[Top][All Lists]
Advanced

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

octave & pipes


From: Anne Rogers
Subject: octave & pipes
Date: Tue, 15 Jul 2008 19:41:34 -0500


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.

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", '-')'

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








reply via email to

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