How do I create a S-Function with generated Code (Simulink Coder)?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I want to generate Code from a Model (e.g. a Subsystem), modify the Code, and create a S-Function with the modified Code. The Code-generation isn't the Problem - i think - I'm just using Simulink Coder to generate the Code. The Problem is to create a S-Function with the generated Code. It doesnt work, even if I dont modify the Code.
What I've tried:
- Creating a .mexw64 file by using "mex" in the Console - that worked so far, but I couldnt connect the mex file with a S-Function.
- Using legacy code Tool - the S-Function I generated with legacy_code doesnt have In/Output ports. The OutputFcnSpec of legacy code would be very much effort to write, if its a complex model.
Is there an easy way to do this?
1 Kommentar
xida zhou
am 8 Mai 2019
What I know is that you cann't create a S-function by use the code which generated by Simulink coder. If you want to create a S-function in a simple way, you should follow Madhu Govindarajan's answer.
Antworten (2)
Madhu Govindarajan
am 19 Nov. 2015
You can create subsystems out of algorithms that are of concern and right click on the subsystem > C/C++ code > generate S-function, this way you can create the S-function directly without having to create the code and modify it. But if that is part of your workflow then I am not sure how to go about this, maybe there is a way to parameterize stuff in S-functions.
1 Kommentar
Bharat
am 30 Sep. 2020
Hi Madhu, What you are saying that, if we follow right click on the subsystem > C/C++ code > generate S-function. Which means we don't need to generate code for S-function correct?
Is this apply for Targetlink block in simulink model?
Siehe auch
Kategorien
Mehr zu Simulink Coder finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!