help-octave
[Top][All Lists]
Advanced

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

Re: Saving variables file name


From: Jonathan C. Webster
Subject: Re: Saving variables file name
Date: Sun, 10 Oct 2004 11:53:13 -0400
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.2) Gecko/20040805 Netscape/7.2



 Sure you can.  Construct the fname of your choice with sprintf.
 Then construct an Octave command using that name and eval() it.

 fileNam = sprintf("%s.txt",runNo);
 str = sprintf("save %s v",fileNam);
 eval(str);

 Hope that helps.
 Jonathan


Mikolaj Karolczak wrote:

Hello!

Is there any possibility to save variables in files using parametrical file name? The 'save' function reads exactly what I type as a file name so I can't save the variable which is for example in an iteration process under different
file names. e.g.
for i=1:10
   (do something with variable v)
   fname = ["file", i, ".txt"];
   save fname v
endfor

I would like Octave to save v under "file1.txt", "file2.txt" etc., not under
"fname".
Regards,
Mikolaj Karolczak




-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------





-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------





-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



reply via email to

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