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??
0 个评论
采纳的回答
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 个评论
更多回答(1 个)
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
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 Center 和 File Exchange 中查找有关 Target Language Compiler 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!