help-octave
[Top][All Lists]
Advanced

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

Re: loading a file using a variable name


From: James Sherman Jr.
Subject: Re: loading a file using a variable name
Date: Thu, 12 Jul 2007 16:38:09 -0400

You could add that directory to your path by using the "addpath" command.  Then you won't need the directory.

On 7/12/07, address@hidden <address@hidden> wrote:
But it wont work if the filename hast a directory path in it, like
filename = 'inputs/variables.m'
eval(sprintf("%s", filename ))

Is there a way to overcome it?


On 7/12/07, address@hidden <address@hidden> wrote:
> > If on the other hand you wanted a script that declared var1 and var2 as
> > above, you could put (like David said) the lines:
> > var1 = 100;
> > var2 = 200;
> > in a file called "var.m", then (assuming it is in your present directory or
> > path) type
> > > var
> > at the command line.
>
> yes I want this, but the file name, in this case var, should be
> given by a variable. I solved it with:
> octave> filename='var'
> octave> eval(sprintf("%s", filename ))
>


reply via email to

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