[Top][All Lists]

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

loading data

From: David D. Clark
Subject: loading data
Date: Thu, 13 Aug 1998 12:21:25 -0600 (MDT)

I would like to be able to use the input command to load a file name
without an extension, <filename>, use the strcat command to concatenate
the string with the appropriate extension, <ext> and then use the load
command to load the file <filename>.<ext>


filename=input("Data File: ","s")
load datafile

However, when I run this, the following error occurs

octave:47> filename=input("Data File: ", "s")
Data File: m0812x
filename = m0812x
octave:48> datafile=strcat(filename,".dat")
datafile = m0812x.dat
octave:49> load datafile
error: load: couldn't open input file `datafile'
error: evaluating index expression near line 49, column 1

This indicates to me that load is looking at datafile as a literal, rather
than a variable.  Is there any way to get load to look at its argument as
a variable.  There is indeed a file named m0812x.dat. 

Also, perhaps load does not like a string variable, in which case I need
to know what format to convert the string to.

Thanks for your help,

Dave Clark

David D. Clark
Graduate Research Assistant, Biophysics Group, P-21
MS D454
Los Alamos National Laboratory
Los Alamos, NM 87545
Phone (505)667-4147 Fax (505)665-4507

reply via email to

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