Matlab Coder and fminsearch

3 visualizaciones (últimos 30 días)
Arwel
Arwel el 13 de Abr. de 2018
Respondida: Steven Lord el 13 de Abr. de 2018
Hi,
I am trying to compile an application which uses fminsearch using Matlab Coder. In the documentation for coder it suggests that fminsearch is suitable for code generation. However, when I try to compile I get errors like the following....
"Size mismatch (size [1 x 15] ~= size [1 x 6]). The size to the left is the size of the left-hand side of the assignment."
When I check the relevant line, it's falling over here.....
if fxe < fxr
v(:,end) = xe;
fv(:,end) = fxe;
how = 'expand';
...basically at the how = 'expand'; line. Looking at the subsequent errors, it's also complaining about subsequent setting of 'how' like this.....
Size mismatch (size [1 x 15] ~= size [1 x 16]). The size to the left is the size of the left-hand side of the assignment.
when it tries...
how = 'contract inside'
and so on.... So obviously it doesn't like the fact that 'how' keeps changing size. If fminsearch is meant to be suited for codegen, why is it throwing this error???
Cheers,
Arwel

Respuestas (1)

Steven Lord
Steven Lord el 13 de Abr. de 2018
Which release of MATLAB are you using? If you're using a release prior to release R2014a when support for code generation from fminsearch was introduced, that may be the cause of the error you received.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by