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