フィルターのクリア

Output type definition for extrinsic function (polyxpoly) in Simulink

2 ビュー (過去 30 日間)
Rod
Rod 2013 年 8 月 16 日
コメント済み: Sharan Duggirala 2015 年 4 月 17 日
Hi,
I'm needing to use an extrinsic function in an embedded matlab block in simulink (polyxpoly).
My problem is that the output of this function is an x by 2 array where x varies. I am therefore unable to define the output type without getting an mxarray error.
How can I make use of this function in a simulink matlab function block?

採用された回答

Kaustubha Govind
Kaustubha Govind 2013 年 8 月 16 日
編集済み: Kaustubha Govind 2013 年 8 月 16 日
Since the Embedded MATLAB block uses static memory allocation, it cannot handle variables that change size dynamically. What you can do is declare your output as variable-sized while specifying an upper bound for the size.
function y = myfun(x)
coder.varsize('y', [1024 2]); %x must never exceed 1024
coder.extrinsic('polyxpoly');
y = zeros(x, 2); %pre-declare the type and size of y
y = polyxpoly(x, other_args, ...);
Also, be sure to configure the output as variable-size on the Ports and Data Manager.
  1 件のコメント
Sharan Duggirala
Sharan Duggirala 2015 年 4 月 17 日
Hi,
During code generation, I keep getting the error -
' CODER.VARSIZE is not applicable to 'mxArray '. '
Has anyone encountered this/ know a way around this?
Here is a screenshot of the code generation error report :

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by