MATLAB: Does the generated code contain temporary copies of the inputs if the model contains an Embedded MATLAB function with subfunctions when using Real-Time Workshop Embedded Coder 5.0 (R2007b)

inline()simulink codersub function

I have a Simulink model that contains an Embedded MATLAB function block. This Embedded MATLAB function block contains a function with some subfunctions.
When my subfunction contains a while loop, the generated code contains a temporary copy of my input variables and then passes this temporary variable to the subfunctions. Creating temporary copies of the input variables is inefficient if the input variable is large (say, a variable containing 1000000 elements).
If my subfunction does not contain a while loop, then all the functions and subfunctions are inlined in the generated code and no temporary copies of the input variables are created.

Best Answer

The ability to force a subfunction to be inlined in the generated code is not available in Real-Time Workshop Embedded Coder 5.0 (R2007b) and prior versions of Real-Time Workshop Embedded Coder.
In Real-Time Workshop Embedded Coder 5.1 (R2008a), there is an option "eml.inline('always')" which forces inlining of the current function in generated code. In order to inline a function in the generated code, insert the following code inside the function.
eml.inline('always') ;
Additional information on this option can be found at the following link:
<http://www.mathworks.com/access/helpdesk/help/toolbox/eml/ug/eml.inline.html>
Related Question