help-octave
[Top][All Lists]
Advanced

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

Re: User input file selection


From: Stuart Edwards
Subject: Re: User input file selection
Date: Wed, 26 Aug 2009 20:08:43 -0400

thank you!

On Aug 26, 2009, at 9:47 AM, Rob Mahurin wrote:

On Aug 26, 2009, at 9:32 AM, Stuart Edwards wrote:
This is probably a trivial question, but has me stumped.  I'm writing
a script that requires the user to input the name of a data file, and
then load and process the contents.

datafile=input("enter the name of the datafile ", "s")
load datafile

after inputing the file name, this returns an error 'could not find
the file datafile'

Right, 'load datafile' is the same as 'load("datafile")'.

datafile=input("enter the name of the datafile ", "s")
load(datafile)

seems to load the name of the datafile as a string and subsequent
processing merely shuffles the characters in the file name around.
I've tried various other syntax 'guesses' but no success.

Right, because datafile is the string containing the filename.
Try data = load(datafile).

Rob

--
Rob Mahurin
University of Manitoba, Dept. of Physics & Astronomy
at:     Oak Ridge National Laboratory   865 207 2594
        Oak Ridge, Tennessee            address@hidden




reply via email to

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