Optimizing the use of Embedded Matlab Function

Question

Does RT-LAB support Embedded Matlab Fcn ? are they some rules or tricks to know to optimize this use ? 

Answer

Embedded Matlab Fcn are actually supported by RT-LAB, but there are some rules to decrease the code generation time. One important rule is to avoid duplication : if possible, do not use n times the same block, use one block that contains code for n cases. Code generation will be quicker because code for the block itself is generated only once.

Also there is a bug with versions up to R2008a (fixed after that) : if your m-code has a variable which has the same name of an existing Matlab function, this could crash the compilation. Please make sure that the variable you are using do not refer to Matlab function by typing "which variable_name" in Matlab command prompt

 

Keywords : embedded, S-function