|
From: | James Sherman Jr. |
Subject: | Re: loading a file using a variable name |
Date: | Thu, 12 Jul 2007 16:38:09 -0400 |
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 ))
>
[Prev in Thread] | Current Thread | [Next in Thread] |