Clear Filters
Clear Filters

How to create a .tlc wrapper file to inline s functions - question on tutorial

13 views (last 30 days)
I am primarily looking for information on how to generate the .TLC file as described here. https://www.mathworks.com/help/rtw/tlc/wrapping-user-code-with-tlc.html
Referencing tutorial found here
C:\Software\Mathworks\Matlab_All_Products_2017b\toolbox\rtw\rtwdemos\tlctutorial\wrapper
I have an sfunction (X) with files X.c, X.h, X.mex. These were created using Simulink subsystem, right click, C, Generate S function.
In the example, there are two c files referenced, my_alg.c and wrapsfcn.c, no header. Is my S function X equivalent to wrapsfcn.c and wrapsfcn.mex, or do I need to copy my X.c to change_wrapsfcn.tlc as shown in the example?
Basically, is change_wrapsfcn.tlc a generic template where I need to add my C code from X.c to create the X.tlc? If not, where do I start for my .tlc file with X.c, X.h, and X.mex?

Answers (1)

Sahas
Sahas on 4 Sep 2024
Hi @Aubrey,
As per my understanding, you would like to generate TLC files and wants to know if the TLC file mentioned in the example can be used as a template for this task.
The “change_wrapsfcn.tlc” file in the example can be considered as a template on guiding how to write wrapper functions for custom C-code. However, you will need to customize it to fit your specific S-function.
Follow the steps given below to make a custom TLC file:
  • Create a new file named “X.tlc” and duplicate the contents of the "change_wrapsfcn.tlc" file into it.
  • Modify the logic to call appropriate functions from the “X.c” file.
  • Ensure that the file includes the necessary logic to handle the inputs, outputs, and parameters with appropriate data types as defined in the S-function.
Refer to the following MathWorks documentation links for steps to write custom inline TLC files and understanding their syntax:
Hope this is beneficial!

Products


Release

R2017b

Community Treasure Hunt

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

Start Hunting!