> datfile = 'xxx.dat'
> load datfile
>
> And to load a file with variables set in it like:
> var1=100;
> var2=200;
>
> the load command gives an error. Command fopens runs,
> but then the variables are no loaded, i do not konw how to do that.
> I know executing the filename works, but if the filename is given
> by a variable, then i do not know how to execute it.
> Any idea?
> Thanks in advance ...
Hi,
In this case you have to use the functional form of load. Example:
datfile = 'mmm'
datfile = mmm
octave:2> load(datfile)
octave:3> whos
*** local user variables:
Prot Name Size Bytes Class
==== ==== ==== ===== =====
rw- __nargin__ 1x1 8 scalar
rwd datfile 1x3 3 string
rwd mmm 9x2 144 matrix
Total is 22 elements using 155 bytes
...at least on the old GNU Octave, version 2.1.73.
Cheers, Avraham
--
Please avoid sending to this address attachments in excess of 2MByte,
or any Excell or Powerpoint attachments.