Problem in writing TLC file for Matlab Level2 M file s function

2 次查看(过去 30 天)
Am facing issue in creating dll, for that i need to write TLC file for Level2 M file S function. I need TLC file format.... Its is possible to generate code for Level2 M file S function with out tlc file??

采纳的回答

Kaustubha Govind
Kaustubha Govind 2013-5-8
No, you do need to write a TLC file to generate code from a MATLAB S-function. If your algorithm is simple enough to write as a function (ie. no states or initialize/terminate methods), you may want to try using the MATLAB Function block instead. As long as you're writing MATLAB code that is compatible for code-generation (read the previously linked documentation for details), you will be able to generate code from the block.
  2 个评论
vinothkannan K
vinothkannan K 2013-5-9
Thanks kaustubha for your answer., But am using Level2 s function because its taking data from GUI., It just contains output function only.... For that only i need to writ tlc file... any tlc file format is there? Am trying with different method but its not taking....

请先登录,再进行评论。

更多回答(1 个)

Inibrith
Inibrith 2014-6-6
Hi Kaustubha,
TLC examples in Matlab Documentation are not very useful. I sometimes have the need to hook up some external components into Simulink, using java methods. I would like to have a step by step creation from Level-2 code to TLC to RTW (now Simulink coder) so that my block diagram gets compiled into an executable. The timestwo example basically tells me I have to re-write the code (as if it were really simple) for "optimization". Why such a simple example as multiplying by two needs to be optimized anyway? Like if for multiplying by two, one has first to take the integral of a Riemann series, take the square root, chopping away any complex conjugated number, then take the Lyapunov function (for whatever reason you ever need to do that) to resolve a differential equation... See the picture? Suffice to say, I don't really see any value added by a TLC file, with the example provided.
People looking at such simple (unhelpful BTW) example would raise the (very reasonable) question about: Why can't we automatically generate the TLC file? If it is the same as re-naming functions such as those exposed! Or even better... why not writing it in the first place with that language? If it is "optimized" already, everyone would like to have a faster simulation anytime.
Any useful information, step by step example, where we can hook and tell the compiler how to deal with your M code so that it gets compiled using Simulink coder, would be very much appreciated.
Best regards,
Inibrith H.
  1 个评论
Kaustubha Govind
Kaustubha Govind 2014-6-6
It is currently possible to automatically generate TLC files for C-MEX S-functions using the Legacy Code Tool and S-function Builder.
For MATLAB code, we recommend that you use either the MATLAB Function block or MATLAB System block (MATLAB code needs to be written in the form of a System object) - both blocks automatically generate C code, as long as your MATLAB code is supported for code-generation. Please see the documentation for more information on code-generation support for MATLAB.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Target Language Compiler 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by