help-octave
[Top][All Lists]
Advanced

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

Re: sprintf to make filenames


From: John Day
Subject: Re: sprintf to make filenames
Date: Mon, 11 Mar 2002 11:34:47 -0500

Use the "eval() function", Mike,

eval(['save -ascii ', sprintf("file_%04d.dat",i),' matrixdata']);

-jday

At 10:33 AM 3/11/02 -0600, Mike Miller wrote:
Hello all--

I want to be able to use the usual save command of this form:

save -ascii file_0001.dat matrixdata

but I'd like for the filename to be determined by a variable in this sort
of way:

i=1;
save -ascii sprintf("file_%04d.dat",i) matrixdata

That doesn't work because Octave doesn't seem to interpret the sprintf
command to produce the string for the filename.  How can I get this to
work?

TIA,

Mike




-------------------------------------------------------------
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]