[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: parameter a file name to be saved
From: |
mats . jansson |
Subject: |
Re: parameter a file name to be saved |
Date: |
Tue, 19 Jan 1999 14:37:27 +0100 |
> Hello,
>
> I would like to know if it is possible to parameter files name and files
> locations.
>
> I have a function f(a) which produce a matrix function of a. I would
> like to save it in a dircetory called ~/dir_a with the name a.dat.
> So if a = 1, I would like to have ~/dir_1/1.dat
> if a = 2, ~/dir_2/2.dat ...
>
> Does anyone know if it possible and then how to do it.
>
> Thanks in advance
>
> Daniel
Try something like this:
octave:1> a=1
a = 1
octave:2> fcn=f(a);
octave:3> ind=num2str(a)
ind = 1
octave:4> file=["~/dir_" ind "/" ind ".dat"]
file = ~/dir_1/1.dat
octave:5> str2eval=["save " file " fcn"]
str2eval = save ~/dir_1/1.dat fcn
octave:6> eval(str2eval)
/Mats