Compiling and using a mexFunction in Simulink
3 次查看(过去 30 天)
显示 更早的评论
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.
0 个评论
回答(1 个)
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:
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Parrot Minidrones 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!