Using Simulink Previous page   Next Page

Specifying Argument Types with Expressions

You can specify the type of an argument with an expression that you enter in the Type field of its Data properties dialog box as follows:

  1. Click on the text area of the Type field to place a cursor in that field.
  2. Enter an expression with the type operator that returns the type of a previously defined variable.
  1. For example, if the variable x is already defined, enter type(x). In this case, x can be another argument. x can be defined with any supported type, including the type inherited.

In the following example, the local variable data is specified with a DataType of type(vals). The input data vals inherits its type from a Constant block whose output signal is set to the type uint8.

Click the Build tool to compile and build the model from the Embedded MATLAB Editor. When the model is compiled, the actual type of data appears in the CompiledType column in the Contents pane.


Previous page  Selecting Types for Arguments Sizing Function Arguments Next page

© 1994-2005 The MathWorks, Inc.