help-octave
[Top][All Lists]
Advanced

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

Re: loading a filename beginning with a digit


From: Luc Lefebvre
Subject: Re: loading a filename beginning with a digit
Date: Mon, 21 Jul 2003 08:51:25 -0400 (EDT)

Hi,

I don't believe that a variable name can start with a numeric value.  If 
the file name _must_ start with a numeric value, might I suggest a 
combination of "open" and "read" operations, reading the file into a 
variable with a legal name <twox for ex>.

cheers

On Sun, 20 Jul 2003, Mike Miller wrote:

> Suppose, for example, that I have a file named 2x.txt with these contents:
> 
> 1 3
> 9 5
> 
> (Just two lines with two integers per line, but in real life I'll want to
> do this with larger files!)  When I load the file, I am not able to access
> the data.  (Please don't tell me to rename the file!  I just want to make
> the load function work within a script I'm writing no matter what the
> filename, if that's possible.)  I did this in a couple of versions of
> Octave on Solaris 8:
> 
> 
> octave:1> load 2x.txt
> octave:2> whos
> 
> *** local user variables:
> 
> prot  type               rows   cols  name
> ====  ====               ====   ====  ====
>  wd   matrix                2      2  2x
> 
> octave:3> 2x
> parse error:
> 
> >>> 2x
>      ^
> 
> octave:3> "2x"
> ans = 2x
> octave:4> eval("2x")
> parse error:
> 
> >>> 2x
>      ^
> 
> error: evaluating index expression near line 4, column 1
> 
> 
> So, Octave seems to load the 2x2 matrix, but I just can't figure out how
> to get at it.  (I thought Octave didn't allow variables beginning with a
> digit.)  I'd really like to be able to rename the loaded matrix, but how?
> 
> Thanks in advance for any tips!
> 
> Mike
> 
> 

-- 
Luc Lefebvre

In the beginner's mind there are many possibilities,
in the expert's mind there are few.                     <Shunryu Suzuki>

Key fingerprint = D2E5 5E35 B910 6F4E 0242  EC63 0FD9 96D0 C7F4 784E



-------------------------------------------------------------
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]