Using Simulink Previous page   Next Page

Declaring Local Variables Implicitly

You declare variables implicitly in Embedded MATLAB functions by specifying constants and making initial assignments. By default, this type of variable does not persist between function calls. It is recreated for each function call and has no identity or value outside the Embedded MATLAB function. You can, however, make this variable persistent with a persistent statement at the top of the function body before the first use of the variable. For example, to declare the variable abc persistent, enter the following line right after the function header and comments:

You declare variables implicitly in the function body of Embedded MATLAB functions in the following ways:

The following rules apply to the use of variables that you declare implicitly in the body of an Embedded MATLAB function:


Previous page  Local Variables in Embedded MATLAB Functions Declaring Local Complex Variables Implicitly Next page

© 1994-2005 The MathWorks, Inc.