[Top][All Lists]

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

loading a filename beginning with a digit

From: Mike Miller
Subject: loading a filename beginning with a digit
Date: Sun, 20 Jul 2003 20:25:55 -0500 (CDT)

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!


Michael B. Miller, Ph.D.
Assistant Professor
Division of Epidemiology
and Institute of Human Genetics
University of Minnesota

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

Octave's home on the web:
How to fund new projects:
Subscription information:

reply via email to

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