Is it possible to generate a Mex function which has within it another mex function?

1 回表示 (過去 30 日間)
Giulio Brandizzi
Giulio Brandizzi 2022 年 9 月 20 日
コメント済み: Giulio Brandizzi 2022 年 9 月 21 日
I am trying to create a Mex function of a complex algorithm in which it resides the Mex function VchooseK (https://it.mathworks.com/matlabcentral/fileexchange/26190-vchoosek).
Until the generation step there are no errors but then while generating the following error appeares:
The extrinsic function 'VChooseK' is not available for standalone code generation. It must be eliminated for stand-alone code to be generated. It could not be eliminated because its outputs appear to influence the calling function. Fix this error by not using 'VChooseK' or by ensuring that its outputs are unused.
Does anyone have any solution for this? Is it even possible to have a "nested" mex?
Thank you.

回答 (1 件)

Steven Lord
Steven Lord 2022 年 9 月 20 日
I'm not 100% certain but if you're trying to generate code using MATLAB Coder on a file that calls a MEX-file, you may be able to do something like what you want using coder.ceval or some of the other functions listed on this category page in the documentation.
  2 件のコメント
James Tursa
James Tursa 2022 年 9 月 20 日
Just a side note. Hand-written mex functions can certainly call other mex functions via the mexCallMATLAB( ) function. I have done this many times, so the basic capability is there for nesting mex routine calls. But I don't use the Coder so can't comment on that aspect of it.
Giulio Brandizzi
Giulio Brandizzi 2022 年 9 月 21 日
I should have pointed out that i have already tried by using coder.extrinsic, as without it during generation the error states:
"... Consider using coder.extrinsic to declare MEX function as extrinsic."
And with it the error is the aforementioned one.
@James Tursa Could you point to me a tutorial on how to create a hand written mex? Is it possible to act on the C/C++ code while it is created by the Matlab Coder?

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

カテゴリ

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

タグ

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by