[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
function files (was: why is octave such a crap?)
From: |
Mike Miller |
Subject: |
function files (was: why is octave such a crap?) |
Date: |
Wed, 17 Aug 2016 08:08:51 -0700 |
User-agent: |
Mutt/1.6.2-neo (2016-07-23) |
On Wed, Aug 17, 2016 at 14:50:30 +0000, Frank Zack wrote:
> function retval=octsux(x)
> if(x<1.3) % -inf<x<1.3
> retval=1/(exp(-x(1))+0.27);
> else % 1.3<=x<inf
> retval=4/(3*sqrt(pi))*(x(1)^2+pi^2/6)^(3/4);
> endif
> endfunction
>
> octsux(10)
> warning: function name 'octsux' does not agree with function file name
> '/user/ME/test.m'
> error: 'x' undefined near line 2 column 6
> error: called from
Is the error message unclear? The function name must be the same as the
name of the .m file. A .m file may contain more than one subfunction,
but every public function must be in its own .m file with the same name.
https://www.gnu.org/software/octave/doc/interpreter/Function-Files.html
--
mike
Re: why is octave such a crap?, Juan Pablo Carbajal, 2016/08/17
Re: why is octave such a crap?, Ben Abbott, 2016/08/17