- 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
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
sneha bharadwaj
am 23 Jan. 2017
Kommentiert: sneha bharadwaj
am 30 Jan. 2017
I have a c code i need to call the functions in the c code using s function in simulink... please someone give me the detailed procedure..
0 Kommentare
Akzeptierte Antwort
Easwar Kumar Yarrabikki
am 23 Jan. 2017
3 Kommentare
Easwar Kumar Yarrabikki
am 25 Jan. 2017
Bearbeitet: Easwar Kumar Yarrabikki
am 25 Jan. 2017
Sneha have ever worked with mcc (MATLAB Compiler). In the above answer I suggested you to use MEX command to compile .C files. So if you really want to target a particular library (in your case .dll) you can do that from mcc command. if you need details on mcc check this link
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Simulink Functions finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!