From help-request at octave dot org Wed Jan 4 09:10:00 2006 Subject: Re: Save with variable argument From: Quentin Spencer To: Reiner Suikat CC: help at octave dot org Date: Wed, 04 Jan 2006 09:04:45 -0600 Reiner Suikat wrote: >Hi, > >This may be a stupid question. > >I want the following to work: >Fname = test.mat >save -binary Fname a b c ... > >It appears that whatever I give as an argument to save is taken literally, >it simply does not substitute the filename. >I tried >save -binray (fname) ... > >Well, it saved to (fname). > >What's the trick? > > There are two ways to do this that I can think of: 1) eval(sprintf('save -binary %s a b c',fname)); 2) save('-binary',fname,'a','b','c'); The second one is probably better, because the eval function is slow and should be avoided if there's another way of doing things. ------------------------------------------------------------- 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 -------------------------------------------------------------