|
Re: mpfit questions /strange behavior [message #72718 is a reply to message #72714] |
Fri, 01 October 2010 09:30  |
penteado
Messages: 866 Registered: February 2018
|
Senior Member Administrator |
|
|
On Oct 1, 11:45 am, Paolo <pgri...@gmail.com> wrote:
> On Oct 1, 6:32 am, sirvival <fpfei...@hs.uni-hamburg.de> wrote:
>
>> Hi,
>> I just started getting used to mpfit.
>
>> My question is:
>> I call mpfit2Dfun as mentioned in the description
>> I have a function (extra pro).
>> If I use return, functionname inside the function I get a different
>> result than when I leave the return blank.
>> What am I doing wrong?
>> Also when the return is blank it runs much faster.
>
> A function returns 0 unless you specify the return
> value. There's no reason whatsoever to use a function
> that does not return a value. The returned variable
> does not need to have the same name as the function
> (in fact that is very confusing and should be avoided).
And a function that always returns 0 is probably quick to fit.
|
|
|
Re: mpfit questions /strange behavior [message #72723 is a reply to message #72718] |
Fri, 01 October 2010 07:45  |
pgrigis
Messages: 436 Registered: September 2007
|
Senior Member |
|
|
On Oct 1, 6:32 am, sirvival <fpfei...@hs.uni-hamburg.de> wrote:
> Hi,
> I just started getting used to mpfit.
>
> My question is:
> I call mpfit2Dfun as mentioned in the description
> I have a function (extra pro).
> If I use return, functionname inside the function I get a different
> result than when I leave the return blank.
> What am I doing wrong?
> Also when the return is blank it runs much faster.
A function returns 0 unless you specify the return
value. There's no reason whatsoever to use a function
that does not return a value. The returned variable
does not need to have the same name as the function
(in fact that is very confusing and should be avoided).
Ciao,
Paolo
[skip]
|
|
|