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.