[Top][All Lists]

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

Re: Issue with fminsearch function

From: Markus Mützel
Subject: Re: Issue with fminsearch function
Date: Wed, 11 Sep 2019 09:39:09 +0200

On Tue, 10 Sep 2019 14:15:16 -0400, Joel Lapin wrote
> Hello Octave
> I am using fminsearch to optimize 2 parameters, which are fed to the
> function of interest as a 2 unit row vector -> [# #]. When I run fminsearch
> I get the following error message:
> >> fminsearch('test', [0,1])
> error: fun(0): subscripts must be either integers 1 to (2^63)-1 or logicals
> error: called from
>     fminsearch>nmsmax at line 275 column 8
>     fminsearch at line 165 column 25
> If I debug and go into the function, the issue appears at line 275
> 275: f(1) = dirn * fun (x, varargin{:});
> the variable *fun* is literally the string 'test' and hence the indexing
> issue. Is there a bug in the fminsearch function?
> Thank you in advance
> Joel


You are right. The Octave documentation isn't clear about it. But at least
for Matlab compatibility fminsearch should accept a string as the first input
argument. Using "feval" in the line you are citing would probably be better.
But there might be other places where we rely on the first argument being a
function handle.
Can you open a bug report about this on savannah [1], please?

For the time being, you could work around this by passing a function handle
as the first input argument:
fminsearch(@test, [0,1])



reply via email to

[Prev in Thread] Current Thread [Next in Thread]