How to hide code in S-Function block in simulink?
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
pramod jadhav
el 30 de Mzo. de 2020
Comentada: Fangjun Jiang
el 6 de Abr. de 2020
Using legacy tool and minGW compiler, i have compiled my c code (.c) and header file as well (.h). In result of same i get S-Function Source file (.c) and mex file.
Using mex file, i have created a S-Function block in MATLAB simulink.
Now as per my requirements, i wanted to hide the S-Function Source file (.c) which can be seen via S-Function block in MATLAB simulink.
ultimately my requirement is to, hide the code from user.
Saying all of above, i wanted to know:
- Am i able to hide code sing S-Function block in simulink?
- If Answer to first queston is yes, then how to do so?
0 comentarios
Respuesta aceptada
Fangjun Jiang
el 30 de Mzo. de 2020
You have your source code (in .c or .m or Fortran), compile them into a .mex (or .dll) file using mex() command, then you can use the S-function block in Simulink to use this function.
When you deploy it to other users, you can just copy the .mex or .dll file without including the source code. The user will be able to use the S-function but won't be able to view your source code.
4 comentarios
Fangjun Jiang
el 6 de Abr. de 2020
The .lib file is compiled by a C compiler, such as MS Visual C. The C language S-function is still C code. It can use the functions in the .lib file. The header file is to tell you what functions and their calling syntax.
If you generate the C code and want to use it for embedded control, make sure you provide the .lib file compiled by that embedded C compiler.
Más respuestas (0)
Ver también
Categorías
Más información sobre Simulink Coder en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!