help-octave
[Top][All Lists]
Advanced

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

Re: error: `eig' undefined near line 5 column 7


From: Dmitri A. Sergatskov
Subject: Re: error: `eig' undefined near line 5 column 7
Date: Sat, 31 Jul 2004 10:35:54 -0600
User-agent: Mozilla Thunderbird 0.7.1 (X11/20040626)

Rich Shepard wrote:
...
  I took the syntax from the docs; the sample script. I am still not sure
how to run octave from the command line while passing it the file containing
the 64-element array. I didn't try experimenting with the redirection
operator. Trudging up the learning curve, I am.


This is what I would do. I like separating data and the code. So I create the 
file
(say,  gateway.dat) which contains the data for your matrix, e.g. here is a 
simple 3x3

address@hidden octave]$ cat gateway.dat
11 12 13
21 22 23
31 32 33

Now you can go directly to octave and do:

address@hidden octave]$ octave
GNU Octave, version 2.1.57 (i686-pc-linux-gnu).
Copyright (C) 2004 John W. Eaton.
...
octave:1> A=load("gateway.dat");  # load the data into matrix A
octave:2> A                    #  check that data read OK.
A =

  11  12  13
  21  22  23
  31  32  33

octave:3> b=eig(A)           # this one will display the result, since
                                # there is no ";" at the end
b =

    6.6897e+01
   -8.9690e-01
    4.5349e-16

octave:3> save("-ascii", "b.dat", "b") # Save the results into file b.dat

You can also put all these commands into an "m-file" (say "gataway.m")

address@hidden octave]$ cat gateway.m
A=load("gateway.dat");
b=eig(A);
save("-ascii", "b.dat", "b")

And then:
octave:1> gateway    # Run "m-file"
octave:2> b          # See if it worked
b =

    6.6897e+01
   -8.9690e-01
    4.5349e-16


Hope it helps.

Sincerely,

Dmitri.



-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



reply via email to

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