help-octave
[Top][All Lists]
Advanced

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

Re: Question re function in .m file


From: Miroslaw Kwasniak
Subject: Re: Question re function in .m file
Date: Wed, 15 Dec 2004 10:50:15 +0100
User-agent: Mutt/1.5.6+20040907i

On Tue, Dec 14, 2004 at 08:27:13PM -0800, John B. Thoo wrote:
> 
> Thanks!  Now, how do I understand why typing "source ..." gives no 
> errors when typing "quaderror" or "quaderror (x)" gives errors?

Paul described function-type  m-file implications. "source" does nearly the
same as keyboard input.

In your case - you use Paul suggested  modification - it isn't necessary to
do explicite "source"  or quaderror call. Simply the single:

  [v, ier, nfun, err] = quad ("quaderror", -1, 1)

must work because quad evaluating it first argument will call quaderror
function - if it isn't already definied octave search file "quaderror.m" and
will signal a warnig in case function name mismatch (as in your case) or
error if file "quaderror.m" is missing or it isn't function-type file but a
script or whatever else.

function-type m-file is simply a file that have first statement "function"

Mirek



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