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: oxyopes
Subject: Re: loading a file using a variable name
Date: Thu, 12 Jul 2007 22:03:17 +0200

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]