Matlab Coder and fminsearch

4 ビュー (過去 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 Center および File ExchangeFunction Definition についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by