Problem in writing TLC file for Matlab Level2 M file s function
6 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
vinothkannan K
el 8 de Mayo de 2013
Comentada: Kaustubha Govind
el 6 de Jun. de 2014
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 comentarios
Respuesta aceptada
Kaustubha Govind
el 8 de Mayo de 2013
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 comentarios
Más respuestas (1)
Inibrith
el 6 de Jun. de 2014
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 comentario
Kaustubha Govind
el 6 de Jun. de 2014
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.
Ver también
Categorías
Más información sobre Target Language Compiler en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!