Create Simscape protected or pre-compiled model for users who don't have Simscape licenses
12 views (last 30 days)
Show older comments
I created a Simulink model (Model.slx) containing Simscape blocs. I need to share with some people for compilation purposes who does not have Simscape licenses.
I could create a script to protect the Simulink model:
Simulink.ModelReference.protect('Model.slx', ...
'Path', 'C:\MyFolder', ...
'Report', true, ...
'Mode', 'CodeGeneration', ...
'CodeInterface', 'Top model', ...
'OutputFormat', 'CompiledBinaries');
On my laptop with Simscape licenses, I am able to compile the Simulink (CodeToCompile.slx) that contains the protected model, and the code works as expected. But people who does not have Simscape licenses are not able to compile the code. I tried to compile the Simulink model into C code, but that created mainy .c files, so I am not confident in how to import the compiled model into CodeToCompile.slx.
Am I missing an option into the Simulink.ModelReference.protect function ? Should I go with the generated C code, and add each .c and .h to the Custom Codes of CodeToCompile.slx ? Are there any other way to create a model from Model.slx that people who don't have Simscape licences can compile ?
Many thanks for your help !
0 Comments
Answers (2)
Ayush
on 1 Sep 2025
Edited: Stefanie Schwarz
on 20 Oct 2025 at 12:29
Hi, Valentin,
I understand you want to share a Simulink model containing Simscape blocks with colleagues who do not have a Simscape license.
You can refer this answer posted by MathWorks staff on similar issue:
Hope this helps.
Yifeng Tang
on 3 Sep 2025
I don't think Model reference, protected or not, will allow the user to run without Simscape.
Do you have the licenses needed to create a standalone FMU? You can bring that into a Simulink for a non-Simscape user, and that won't require Simscape license.
0 Comments
See Also
Categories
Find more on Configure and View Diagnostics in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!