help-octave
[Top][All Lists]
Advanced

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

Using a variable in a command insdie a function


From: Edward C. Jones
Subject: Using a variable in a command insdie a function
Date: Tue, 22 Mar 2005 09:29:51 -0600
User-agent: Debian Thunderbird 1.0 (X11/20050116)

I have a command inside a function. I want the command to depend on some variable. Here is an ugly way to do it:

function silly
   filename = 'mess.asc';
   x = 77;
   s = ['save -ascii ' filename ' x'];
   eval(s);
endfunction

Is there a better way? Is there a function corresponding to the "save" command?



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