MATLAB Answers

Using Matlab code with Simulink Real time target

11 ビュー (過去 30 日間)
Sanket Diwale
Sanket Diwale 2014 年 6 月 24 日
回答済み: Juan Reyes 2016 年 6 月 2 日
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.

回答 (1 件)

Juan Reyes
Juan Reyes 2016 年 6 月 2 日
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

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by