help-octave
[Top][All Lists]
Advanced

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

Re: Using a variable in a command insdie a function


From: Brian Blais
Subject: Re: Using a variable in a command insdie a function
Date: Tue, 22 Mar 2005 11:12:48 -0500
User-agent: Mozilla Thunderbird 0.8 (X11/20040913)

Edward C. Jones wrote:
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?


could you do the following?  is this what you want?

function silly
   filename = 'mess.asc';
   x = 77;
   save('-ascii',filename,'x');
endfunction




                                        bb

--
-----------------

            address@hidden
            http://web.bryant.edu/~bblais



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