Matlab Coder and fminsearch

조회 수: 3 (최근 30일)
Arwel
Arwel 2018년 4월 13일
답변: Steven Lord 2018년 4월 13일
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

답변 (1개)

Steven Lord
Steven Lord 2018년 4월 13일
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.

카테고리

Help CenterFile Exchange에서 Function Definition에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by