- First create an S-function for the C-Code that you have. if you haven't deal with S-functions yet, Basic C MEX S-function will be a good start.
- Once you have your C Mex S-function ready, Then Convert your .C file into a MEX file by typing MEX myfilename.C in your work space(Assuming filename as myfilename).
- Then grab S-function block from your user-defined functions library in Simulink into your model. When you double click on the block it will ask you for the S-function file name and parameters that you want to pass on. In file name field give your s-function name, in this case myfilename.
how to link c code to simulink
2 views (last 30 days)
Easwar Kumar Yarrabikki on 23 Jan 2017