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.