Using Simulink Previous page   Next Page

Inheriting Argument Data Types

You can tell an Embedded MATLAB Function block to inherit the data type of an argument from Simulink by selecting inherited in the Type field for that data. In this case, the argument inherits its data type, including fixed-point types, from the Simulink signal that is connected to it. See Selecting Types for Arguments for a list of supported data types.

Once you build the model, the CompiledType column of the Model Explorer gives the actual type used in the compiled simulation application. To conveniently compile and build the model from the Embedded MATLAB Editor, click the Build tool . In the following example, an Embedded Matlab Function block argument inherits its data type from an input signal of type double.

Inheriting the type of input data is successful in all cases. The inherited type of output data is inferred from diagram actions that store values in the specified output. In the preceding example, the variables mean and stdev are computed from operations with double operands, which yield results of type double. If the expected type in Simulink matches the inferred type, inheritance is successful. In all other cases, a mismatch occurs during build time.


Previous page  Typing Function Arguments Selecting Types for Arguments Next page

© 1994-2005 The MathWorks, Inc.