#559 fitfun problem

open
nobody
None
5
2012-06-18
2012-06-18
Christian Felter
No

Using function fitfun gives this error:

Error: function to be optimized does not return any outputs!

Calling the function to be optimized just a single time from the command window makes the problem go away. To reproduce:

File: main.m
fitfun( @myfun, [ 1, 1 ], [ 3, 4, 5 ], [ 1, 1, 1 ] )

File: myfun.m
function f = myfun( c )
x = [ 1, 2, 3 ];
f = c(1) + c(2)*x;

Start by sourcing "main.m". In Freemat 4.2 beta it doesn't work. Now call "myfun( [ 1, 2 ] ). After that sourcing "main.m" works.

Discussion