Could not determine the size of this expression.

20 ビュー (過去 30 日間)
mohamed mb
mohamed mb 2017 年 10 月 11 日
回答済み: Fred Smith 2017 年 10 月 12 日
the Embedded MATLAB fail to detemrine the size of my expression(R2017a), i get this problem.
'Could not determine the size of this expression'.
nbclass=max(LS);
for i=0:nbclass-1
h=plot(Pt(i*nt+1:(i+1)*nt,1),Pt(i*nt+1:(i+1)*nt,2),[style(i+1) color(i+1)]);hold on;
end;

採用された回答

Fred Smith
Fred Smith 2017 年 10 月 12 日
Mohamed,
What specific expression is MATLAB Coder highlighting? What types do the variables in your code snippet have? What ranges are known? Did you turn dynamic memory allocation off?
At a guess, you have turned dynamic memory allocation off and the problem is this expression:
(i*nt+1 :(i+1)*nt)
Proving that this has a bounded size requires symbolic reasoning beyond MATLAB Coder's abilities. If you rewrite it as follow it should work provided nt is bounded
(i*nt + (1:nt))
However, without reproduction steps this is just a guess.
Note, code generation does not generate code for these plotting routines. They will be evaluated using the MATLAB execution engine when run in MATLAB and not show in standalone code at all.
Thanks,
Fred

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMATLAB Coder についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by