Compiling and using a mexFunction in Simulink

5 ビュー (過去 30 日間)
Samuel Kemp
Samuel Kemp 2022 年 10 月 19 日
回答済み: Eshan Patel 2022 年 11 月 2 日
Hello,
I'm not too familiar with S-functions, mex functions, and the use of C overall in MATLAB. There is a utility I want to use found here: https://github.com/mtli/FastFloodFill It has a cpp source file that uses the MATLAB mex interface. The generated mex files work great in the demo_fastfloodfill.m file.
I would like to incorporate this function into a simulink project. Is there a way to just include the source somehow? I've looked into using the C function blooks and I've tried the s-functionbuilder but had no success. It seems to me that if I were able to copy some stuff into the S-Function builder properly, I could get things to work, but I can't figure out how. My knowledge of c++ is quite limited, and I am having trouble working with the data types to try and make this a custom function.

回答 (1 件)

Eshan Patel
Eshan Patel 2022 年 11 月 2 日
Hey Samuel,
I understand that you would like to use the MEX file/function in the GitHub repo with your Simulink model. To do this, you can use the MATLAB Function Block and invoke the MEX function from there. You would not need to use S-functions this way, but this approach will not be supported for code generation. You can refer to this answer for some more details:

カテゴリ

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

製品


リリース

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by