Mex to S-function
2 views (last 30 days)
I am building a binary from C++ code using Mex. I want to use this binary in Simulink—without calling it externally.
How can I use an S-function for this? Note, I use external libraries and several source files. Ideally, I could use the same line of code to compile Mex from Matlab as Simulink.
Saurabh Gupta on 21 Jul 2017
You can create an S-function block from your C++ code using the Legacy Code tool.
Alternatively, if you are only looking to call it as a function for some computation and use the results in Simulink, you could use MATLAB Function block to call it in MATLAB code and use it in Simulink. The following links should be helpful.