Using Matlab code with Simulink Real time target

2 views (last 30 days)
I intend to use my algorithm written in Matlab (.m files) to control a mechanical system using a real time target PC from Speedgoat. I was able to build a model of the mechanical system for simulation in Simulink and then use the matlab code called as an extrinsic function to use it to control the system in simulation. However to transfer this to the real time target one has to go through the Simulink Coder which does not support extrinsic function calls to matlab code. I may also be able to write my .m file codes as Level 2 Matlab S-functions or generate C-code for it using Matlab coder. However it is not clear how to get these to compile with Simulink coder for the real time application. Currently using Matlab level 2 s-functions in my model fails to compile with the Simulink coder as it demands a corresponding .tlc (Target Language Compiler) file to be supplied with the S-function. However I could not find any documentation on what these files are or how to go about writing them.
I would be grateful if anyone can point to the right source of information for integrating your matlab code in simulink in a way that is compatible with the Simulink coder for real time application.

Answers (1)

Juan Reyes
Juan Reyes on 2 Jun 2016
You need to create an S-Block function with a corresponding .tlc file for the code generation. http://www.mathworks.com/help/rtw/block-authoring-with-tlc.html?searchHighlight=Target%20Language%20Compiler

Categories

Find more on Simulink Coder 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!