This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

n-D Lookup Table

Approximate n-dimensional function

  • Library:
  • Simulink / Lookup Tables

Description

Supported Block Operations

The 1-D, 2-D, and n-D Lookup Table blocks evaluate a sampled representation of a function in N variables

y=F(x1,x2,x3,...,xN)

where the function F can be empirical. The block maps inputs to an output value by looking up or interpolating a table of values you define with block parameters. The block supports flat (constant), linear (Linear point-slope), Lagrange (Linear Lagrange), nearest, and cubic-spline interpolation methods. You can apply these methods to a table of any dimension from 1 through 30.

In the following block, the first input identifies the first dimension (row) breakpoints, the second input identifies the second dimension (column) breakpoints, and so on.

See Port Location After Rotating or Flipping for a description of the port order for various block orientations.

When the Math and Data Types > Use algorithms optimized for row-major array layout configuration parameter is set, the 2-D and n-D Lookup Table block behavior changes from column-major to row-major. For these blocks, the column-major and row-major algorithms may differ in the order of the output calculations, possibly resulting in slightly different numerical values. This capability requires a Simulink® Coder™ or Embedded Coder® license. For more information on row-major support, see Code Generation of Matrices and Arrays (Simulink Coder).

Specification of Breakpoint and Table Data

These block parameters define the breakpoint and table data.

Block ParameterPurpose
Number of table dimensions Specifies the number of dimensions of your lookup table.
Breakpoints Specifies a breakpoint vector that corresponds to each dimension of your lookup table.
Table data Defines the associated set of output values.

Tip

Evenly spaced breakpoints can make the generated code division-free. For more information, see fixpt_evenspace_cleanup and Identify questionable fixed-point operations (Embedded Coder).

How the Block Generates Output

The n-D, 1-D and 2-D Lookup Table blocks generate output by looking up or estimating table values based on the input values.

When block inputs...The n-D Lookup Table block...
Match the values of indices in breakpoint data setsOutputs the table value at the intersection of the row, column, and higher dimension breakpoints
Do not match the values of indices in breakpoint data sets, but are within range Interpolates appropriate table values, using the Interpolation method you select
Do not match the values of indices in breakpoint data sets, and are out of range Extrapolates the output value, using the Extrapolation method you select

Other Blocks that Perform Equivalent Operations

You can use the Interpolation Using Prelookup block with the Prelookup block to perform the equivalent operation of one n-D Lookup Table block. This combination of blocks offers greater flexibility that can result in more efficient simulation performance for linear interpolations.

When the lookup operation is an array access that does not require interpolation, use the Direct Lookup Table (n-D) block. For example, if you have an integer value k and you want the kth element of a table, y = table(k), interpolation is unnecessary.

Ports

Input

expand all

Real-valued inputs to the u1 port, mapped to an output value by looking up or interpolating the table of values that you define.

Example: 0:10

Data Types: single | double | int8 | int16 | int32 | uint8 | uint16 | uint32 | fixed point

Real-valued inputs to the uN port, mapped to an output value by looking up or interpolating the table of values that you define.

Example: 0:10

Data Types: single | double | int8 | int16 | int32 | uint8 | uint16 | uint32 | fixed point

Output

expand all

Output generated by looking up or estimating table values based on the input values:

When block inputs...The n-D Lookup Table block...
Match the values of indices in breakpoint data setsOutputs the table value at the intersection of the row, column, and higher dimension breakpoints
Do not match the values of indices in breakpoint data sets, but are within rangeInterpolates appropriate table values, using the Interpolation method you select
Do not match the values of indices in breakpoint data sets, and are out of rangeExtrapolates the output value, using the Extrapolation method you select

Data Types: single | double | int8 | int16 | int32 | uint8 | uint16 | uint32 | fixed point

Parameters

expand all

Table and Breakpoints

Enter the number of dimensions of the lookup table. This parameter determines:

  • The number of independent variables for the table and the number of block inputs

  • The number of breakpoint sets to specify

To specify...Do this...

1, 2, 3, or 4

Select the value from the drop-down list.

A higher number of table dimensions

Enter a positive integer directly in the field.

The maximum number of table dimensions that this block supports is 30.

Programmatic Use

Block Parameter: NumberOfTableDimensions
Type: character vector
Values: '1' | '2' | '3' | '4' | ... | 30
Default: '3'

From the list, select:

  • Table and breakpoints — Specify the table data and breakpoints. Selecting this option enables the following parameters:

    • Table data

    • Breakpoints specification

    • Breakpoints 1

    • Breakpoints 2

    • Breakpoints 3

    • Edit table and breakpoints

  • Lookup table object — Use an existing lookup table (Simulink.LookupTable) object. Selecting this option enables the Name field and Edit table and breakpoints button.

Programmatic Use

Block Parameter: DataSpecification
Type: character vector
Values: 'Table and breakpoints' | 'Lookup table object'
Default: 'Table and breakpoints'

Enter the name of the lookup table (Simulink.LookupTable) object.

Dependencies

To enable this parameter, set Data specification to Lookup table object.

Programmatic Use

Block Parameter: LookupTableObject
Type: character vector
Values: name of a Simulink.LookupTable object
Default: ''

Enter the table of output values.

During simulation, the matrix size must match the dimensions defined by the Number of table dimensions parameter. However, during block diagram editing, you can enter an empty matrix (specified as []) or an undefined workspace variable. This technique lets you postpone specifying a correctly dimensioned matrix for the table data and continue editing the block diagram.

Dependencies

To enable this parameter, set Data specification to Table and breakpoints.

Programmatic Use

Block Parameter: Table
Type: character vector
Values: matrix of table values
Default: 'reshape(repmat([4 5 6;16 19 20;10 18 23],1,2),[3,3,2])'

Specify whether to enter data as explicit breakpoints or as parameters that generate evenly spaced breakpoints.

  • To explicitly specify breakpoint data, set this parameter to Explicit values and enter breakpoint data in the text box next to the Breakpoints parameters.

  • To specify parameters that generate evenly spaced breakpoints, set this parameter to Even spacing and enter values for the First point and Spacing parameters for each dimension of breakpoint data. The block calculates the number of points to generate from the table data.

Dependencies

To enable this parameter, set Data specification to Table and breakpoints.

Programmatic Use

Block Parameter: BreakpointsSpecification
Type: character vector
Values: 'Explicit values' | 'Even spacing'
Default: 'Explicit values'

Specify the breakpoint data explicitly or as evenly-spaced breakpoints, based on the value of the Breakpoints specification parameter.

  • If you set Breakpoints specification to Explicit values, enter the breakpoint set that corresponds to each dimension of table data in each Breakpoints row. For each dimension, specify breakpoints as a 1-by-n or n-by-1 vector whose values are strictly monotonically increasing.

  • If you set Breakpoints specification to Even spacing, enter the parameters First point and Spacing in each Breakpoints row to generate evenly-spaced breakpoints in the respective dimension. Your table data determines the number of evenly spaced points.

Dependencies

To enable this parameter, set Data specification to Table and breakpoints.

Programmatic Use

Block Parameter: BreakpointsForDimension1 | BreakpointsForDimension2 | ... | BreakpointsForDimension30 |
Type: character vector
Values: 1-by-n or n-by-1 vector of monotonically increasing values
Default: '[10, 22, 31]'

Specify the first point in your evenly spaced breakpoint data as a real-valued, finite, scalar. This parameter is available when Breakpoints specification is set to Even spacing.

Dependencies

To enable this parameter, set Data specification to Table and breakpoints, and Breakpoints specification to Even spacing.

Programmatic Use

Block Parameter: BreakpointsForDimension1FirstPoint | BreakpointsForDimension2FirstPoint | ... | BreakpointsForDimension30FirstPoint |
Type: character vector
Values: real-valued, finite, scalar
Default: '1'

Specify the spacing between points in your evenly-spaced breakpoint data.

Dependencies

To enable this parameter, set Data specification to Table and breakpoints, and Breakpoints specification to Even spacing.

Programmatic Use

Block Parameter: BreakpointsForDimension1Spacing | BreakpointsForDimension2Spacing | ... | BreakpointsForDimension30Spacing |
Type: character vector
Values: positive, real-valued, finite, scalar
Default: '1'

Click this button to open the Lookup Table Editor. For more information, see Edit Lookup Tables in the Simulink documentation.

Clicking this button for a lookup table object lets you edit the object and save the new values for the object.

Algorithm

Lookup method

When an input falls between breakpoint values, the block interpolates the output value using neighboring breakpoints. For more information on interpolation methods, see Interpolation Methods.

Dependencies

If you select Cubic spline, the block supports only scalar signals. The other interpolation methods support nonscalar signals.

Programmatic Use

Block Parameter: InterpMethod
Type: character vector
Values: 'Linear point-slope' | 'Flat' | 'Nearest' | 'Linear Lagrange' | 'Cubic spline'
Default: 'Linear point-slope'

Select Clip, Linear, or Cubic spline. See Extrapolation Methods for more information.

If the extrapolation method is Linear, the extrapolation value is calculated based on the selected linear interpolation method. For example, if the interpolation method is Linear Lagrange, the extrapolation method inherits the Linear Lagrange equation to compute the extrapolated value.

Dependencies

To select Cubic spline for Extrapolation method, you must also select Cubic spline for Interpolation method.

Programmatic Use

Block Parameter: ExtrapMethod
Type: character vector
Values: 'Linear' | 'Clip' | 'Cubic spline'
Default: 'Linear'

Select Evenly spaced points, Linear search, or Binary search. Each search method has speed advantages in different circumstances:

  • For evenly spaced breakpoint sets (for example, 10, 20, 30, and so on), you achieve optimal speed by selecting Evenly spaced points to calculate table indices.

    This algorithm uses only the first two breakpoints of a set to determine the offset and spacing of the remaining points.

    Note

    Set Index search method to Evenly spaced points when using the Simulink.LookupTable object to specify table data and the Breakpoints Specification parameter of the referenced Simulink.LookupTable object is set to Even spacing.

  • For unevenly spaced breakpoint sets, follow these guidelines:

    • If input signals do not vary much between time steps, selecting Linear search with Begin index search using previous index result produces the best performance.

    • If input signals jump more than one or two table intervals per time step, selecting Binary search produces the best performance.

A suboptimal choice of index search method can lead to slow performance of models that rely heavily on lookup tables.

Note

The generated code stores only the first breakpoint, the spacing, and the number of breakpoints when:

  • The breakpoint data is not tunable.

  • The index search method is Evenly spaced points.

Programmatic Use

Block Parameter: IndexSearchMethod
Type: character vector
Values: 'Binary search' | 'Evenly spaced points' | 'Linear search'
Default: 'Binary search'

Select this check box when you want the block to start its search using the index found at the previous time step. For inputs that change slowly with respect to the interval size, enabling this option can improve performance. Otherwise, the linear search and binary search methods can take longer, especially for large breakpoint sets.

Dependencies

To enable this parameter, set Index search method to Linear search or Binary search.

Programmatic Use

Block Parameter: BeginIndexSearchUsing PreviousIndexResult
Type: character vector
Values: 'off' | 'on'
Default: 'off'

Specify whether to produce a warning or error when the input is out of range. Options include:

  • None — Produce no response.

  • Warning — Display a warning and continue the simulation.

  • Error — Terminate the simulation and display an error.

Programmatic Use

Block Parameter: DiagnosticForOutOfRangeInput
Type: character vector
Values: 'None' | 'Warning' | 'Error'
Default: 'None'

Using this check box, specify the indexing convention that the block uses to address the last element of a breakpoint set and its corresponding table value. This check box is relevant if the input is larger than the last element of the breakpoint data.

Check BoxBlock Uses Index Of The...Interval Fraction
Selected Last element of breakpoint data on the Table and Breakpoints tab 0
Cleared Next-to-last element of breakpoint data on the Table and Breakpoints tab 1

Given an input u within range of a breakpoint set bp, the interval fraction f, in the range 0 f 1, is computed as shown below.

Suppose the breakpoint set is [1 4 5] and input u is 5.5. If you select this check box, the index is that of the last element (5) and the interval fraction is 0. If you clear this check box, the index is that of the next-to-last element (4) and the interval fraction is 1.

Dependencies

To enable this parameter, set:

  • Interpolation method to Linear.

  • Extrapolation method to Clip.

Programmatic Use

Block Parameter: UseLastTableValue
Type: character vector
Values: 'off' | 'on'
Default: 'off'

Input settings

Select this check box to use only one input port that expects a signal that is n elements wide for an n-dimensional table. This option is useful for removing line clutter on a block diagram with many lookup tables.

Note

When you select this check box, one input port with the label u appears on the block.

Programmatic Use

Block Parameter: UseOneInputPortForAllInputData
Type: character vector
Values: 'off' | 'on'
Default: 'off'

Code generation

Specify whether or not to include code that checks for out-of-range input values.

Check BoxResultWhen to Use

on

Generated code does not include conditional statements to check for out-of-range breakpoint inputs.

When the input is out-of-range, it may cause undefined behavior for generated code and simulations using accelerator mode.

For code efficiency

off

Generated code includes conditional statements to check for out-of-range inputs.

For safety-critical applications

If your input is not out of range, you can select the Remove protection against out-of-range index in generated code check box for code efficiency. By default, this check box is cleared. For safety-critical applications, do not select this check box. If you want to select the Remove protection against out-of-range index in generated code check box, first check that your model inputs are in range. For example:

  1. Clear the Remove protection against out-of-range index in generated code check box.

  2. Set the Diagnostic for out-of-range input parameter to Error.

  3. Simulate the model in normal mode.

  4. If there are out-of-range errors, fix them to be in range and run the simulation again.

  5. When the simulation no longer generates out-of-range input errors, select the Remove protection against out-of-range index in generated code check box.

    Note

    When you select the Remove protection against out-of-range index in generated code check box and the input k or f is out of range, the behavior is undefined for generated code and simulations using accelerator mode.

Depending on your application, you can run the following Model Advisor checks to verify the usage of this check box:

  • By Product > Embedded Coder > Identify lookup table blocks that generate expensive out-of-range checking code

  • By Product > Simulink Check > Modeling Standards > DO-178C/DO-331 Checks > Check usage of lookup table blocks

For more information about the Model Advisor, see Run Model Checks.

Programmatic Use

Block Parameter: RemoveProtectionInput
Type: character vector
Values: 'off' | 'on'
Default: 'off'

Select this check box to enable tunable table size in the generated code. This option enables you to change the size and values of the lookup table and breakpoint data in the generated code without regenerating or recompiling the code.

Dependencies

If you set Interpolation method to Cubic spline, this check box is not available.

Programmatic Use

Block Parameter: SupportTunableTableSize
Type: character vector
Values: 'off' | 'on'
Default: 'off'

Specify the sample time as a value other than -1. For more information, see Specify Sample Time.

Dependencies

This parameter is not visible unless it is explicitly set to a value other than -1. To learn more, see Blocks for Which Sample Time Is Not Recommended.

Programmatic Use

Block Parameter: SampleTime
Type: character vector
Values: scalar
Default: '-1'

Example: [4 6] for a 5-by-7 table

Specify the maximum index values for each table dimension using zero-based indexing. You can specify a scalar or vector of positive integer values using the following data types:

  • Built-in floating-point types: double and single

  • Built-in integer types: int8, int16, int32, uint8, uint16, and uint32

Examples of valid specifications include:

  • [4 6] for a 5-by-7 table

  • [int8(2) int16(5) int32(9)] for a 3-by-6-by-10 table

  • A Simulink.Parameter whose value on generating code is one less than the dimensions of the table data. For more information, see Tunable Table Size in the Generated Code.

Dependencies

To enable this parameter, select Support tunable table size in code generation. On tuning this parameter in the generated code, provide the new table data and breakpoints along with the tuned parameter value.

Programmatic Use

Block Parameter: MaximumIndicesForEachDimension
Type: character vector
Values: scalar or vector of positive integer values
Default: '[]'

Data Types

Specify the table data type. You can set it to:

  • A rule that inherits a data type, for example, Inherit: Same as output

  • The name of a built-in data type, for example, single

  • The name of a data type object, for example, a Simulink.NumericType object

  • An expression that evaluates to a data type, for example, fixdt(1,16,0)

Click the Show data type assistant button to display the Data Type Assistant, which helps you set the data type attributes. For more information, see Specify Data Types Using Data Type Assistant.

Tip

Specify a table data type different from the output data type for these cases:

  • Lower memory requirement for storing table data that uses a smaller type than the output signal

  • Sharing of prescaled table data between two n-D Lookup Table blocks with different output data types

  • Sharing of custom storage table data in the generated code for blocks with different output data types

Programmatic Use

Block Parameter: TableDataTypeStr
Type: character vector
Values: 'Inherit: Inherit from 'Table data'' | 'Inherit: Same as output' | 'double' | 'single' | 'int8' | 'uint8' | 'int16' | 'uint16' | 'int32' | 'uint32' | 'fixdt(1,16)' | 'fixdt(1,16,0)' | 'fixdt(1,16,2^0,0)'|'<data type expression>'
Default: 'Inherit: Same as output'

Specify the minimum value for table data. The default value is [] (unspecified).

Programmatic Use

Block Parameter: TableMin
Type: character vector
Values: scalar
Default: '[]'

Specify the maximum value for table data. The default value is [] (unspecified).

Programmatic Use

Block Parameter: TableMax
Type: character vector
Values: scalar
Default: '[]'

Specify the data type for a set of breakpoint data. You can set it to:

  • A rule that inherits a data type, for example, Inherit: Same as corresponding input

  • The name of a built-in data type, for example, single

  • The name of a data type class, for example, an enumerated data type class

  • The name of a data type object, for example, a Simulink.NumericType object

  • An expression that evaluates to a data type, for example, fixdt(1,16,0)

Tip

  • Breakpoints support unordered enumerated data. As a result, linear searches are also unordered, which offers flexibility but can impact performance. The search begins from the first element in the breakpoint.

  • If the Begin index search using previous index result check box is selected, you must use ordered monotonically increasing data. This ordering improves performance.

  • For enumerated data, Extrapolation method must be Clip.

  • The block does not support out-of-range input for enumerated data. When specifying enumerated data, include the entire enumeration set in the breakpoint data set. For example, use the enumeration function.

This is a limitation for using enumerated data with this block:

  • The block does not support out-of-range input for enumerated data. When specifying enumerated data, include the entire enumeration set in the breakpoint data set. For example, use the enumeration function.

Click the Show data type assistant button to display the Data Type Assistant, which helps you set the data type attributes. For more information, see Specify Data Types Using Data Type Assistant.

Tip

Specify a breakpoint data type different from the corresponding input data type for these cases:

  • Lower memory requirement for storing breakpoint data that uses a smaller type than the input signal

  • Sharing of prescaled breakpoint data between two n-D Lookup Table blocks with different input data types

  • Sharing of custom storage breakpoint data in the generated code for blocks with different input data types

Programmatic Use

Block Parameter: BreakpointsForDimension1DataTypeStr | BreakpointsForDimension2DataTypeStr| ... | BreakpointsForDimension30DataTypeStr
Type: character vector
Values: 'Inherit: Same as corresponding input' | 'Inherit: Inherit from 'Breakpoint data'' | 'double' | 'single' | 'int8' | 'uint8' | 'int16' | 'uint16' | 'int32' | 'uint32' | 'fixdt(1,16)' | 'fixdt(1,16,0)' | 'fixdt(1,16,2^0,0)'|'<data type expression>'
Default: 'Inherit: Same as corresponding input'

Specify the minimum value that a set of breakpoint data can have. The default value is [] (unspecified).

Programmatic Use

Block Parameter: BreakpointsForDimension1Min | BreakpointsForDimension2Min | ... | BreakpointsForDimension30Min
Type: character vector
Values: scalar
Default: '[]'

Specify the maximum value that a set of breakpoint data can have. The default value is [] (unspecified).

Programmatic Use

Block Parameter: BreakpointsForDimension1Max | BreakpointsForDimension2Max | ... | BreakpointsForDimension30Max
Type: character vector
Values: scalar
Default: '[]'

Specify the fraction data type. You can set it to:

  • A rule that inherits a data type, for example, Inherit: Inherit via internal rule

  • The name of a built-in data type, for example, single

  • The name of a data type object, for example, a Simulink.NumericType object

  • An expression that evaluates to a data type, for example, fixdt(1,16,0)

Click the Show data type assistant button to display the Data Type Assistant, which helps you set the data type attributes. For more information, see Specify Data Types Using Data Type Assistant.

Programmatic Use

Block Parameter: FractionDataTypeStr
Type: character vector
Values: 'Inherit: Inherit via internal rule' | 'double' | 'single' | 'fixdt(1,16,0)'|'<data type expression>'
Default: 'Inherit: Inherit via internal rule'

Specify the intermediate results data type. You can set it to:

  • A rule that inherits a data type, for example, Inherit: Same as output

  • The name of a built-in data type, for example, single

  • The name of a data type object, for example, a Simulink.NumericType object

  • An expression that evaluates to a data type, for example, fixdt(1,16,0)

Click the Show data type assistant button to display the Data Type Assistant, which helps you set the data type attributes. For more information, see Specify Data Types Using Data Type Assistant.

Tip

Use this parameter to specify higher (or lower) precision for internal computations than for table data or output data.

Programmatic Use

Block Parameter: IntermediateResultsDataTypeStr
Type: character vector
Values: 'Inherit: Inherit via internal rule' | 'Inherit: Same as output' | 'double' | 'single' | 'int8' | 'uint8' | 'int16' | 'uint16' | 'int32' | 'uint32' | 'fixdt(1,16,0)' | 'fixdt(1,16,2^0,0)'|'<data type expression>'
Default: 'Inherit: Same as output'

Specify the output data type. You can set it to:

  • A rule that inherits a data type, for example, Inherit: Inherit via back propagation

  • The name of a built-in data type, for example, single

  • The name of a data type object, for example, a Simulink.NumericType object

  • An expression that evaluates to a data type, for example, fixdt(1,16,0)

Click the Show data type assistant button to display the Data Type Assistant, which helps you set the data type attributes. For more information, see Specify Data Types Using Data Type Assistant.

Programmatic Use

Block Parameter: OutDataTypeStr
Type: character vector
Values: 'Inherit: Inherit via back propagation' | 'Inherit: Inherit from table data' | 'Inherit: Same as first input' | 'double' | 'single' | 'int8' | 'uint8' | 'int16' | 'uint16' | 'int32' | 'uint32' | 'fixdt(1,16,0)' | 'fixdt(1,16,2^0,0)'|'<data type expression'
Default: 'Inherit: Same as first input'

Specify the minimum value that the block outputs. The default value is [] (unspecified). Simulink software uses this value to perform:

Programmatic Use

Block Parameter: OutMin
Type: character vector
Values: scalar
Default: '[]'

Specify the maximum value that the block can output. The default value is [] (unspecified). Simulink software uses this value to perform:

Programmatic Use

Block Parameter: OutMax
Type: character vector
Values: scalar
Default: '[]'

Specify the internal rule for intermediate calculations. Select Speed for faster calculations. If you do, a loss of accuracy might occur, usually up to 2 bits.

Programmatic Use

Block Parameter: InternalRulePriority
Type: character vector
Values: 'Speed' | 'Precision'
Default: 'Speed'

Select to require all inputs to have the same data type.

Programmatic Use

Block Parameter: InputSameDT
Type: character vector
Values: 'off' | 'on'
Default: 'on'

Select this parameter to prevent the fixed-point tools from overriding the data types you specify on this block. For more information, see Lock the Output Data Type Setting (Fixed-Point Designer).

Programmatic Use

Block Parameter: LockScale
Type: character vector
Values: 'off' | 'on'
Default: 'off'

Specify the rounding mode for fixed-point lookup table calculations that occur during simulation or execution of code generated from the model. For more information, see Rounding (Fixed-Point Designer).

This option does not affect rounding of values of block parameters. Simulink rounds such values to the nearest representable integer value. To control the rounding of a block parameter, enter an expression using a MATLAB® rounding function into the edit field on the block dialog box.

Programmatic Use

Block Parameter: RndMeth
Type: character vector
Values: 'Ceiling' | 'Convergent' | 'Floor' | 'Nearest' | 'Round' | 'Simplest' | 'Zero'
Default: 'Simplest'

ActionReasons for Taking This ActionWhat Happens for OverflowsExample

Select this check box (on).

Your model has possible overflow and you want explicit saturation protection in the generated code.

Overflows saturate to either the minimum or maximum value that the data type can represent.

An overflow associated with a signed 8-bit integer can saturate to -128 or 127.

Do not select this check box (off).

You want to optimize efficiency of your generated code.

You want to avoid overspecifying how a block handles out-of-range signals. For more information, see Check for Signal Range Errors.

Overflows wrap to the appropriate value that is representable by the data type.

The number 130 does not fit in a signed 8-bit integer and wraps to -126.

Tip

If you save your model as version R2009a or earlier, this check box setting has no effect and no saturation code appears. This behavior preserves backward compatibility.

When you select this check box, saturation applies to every internal operation on the block, not just the output or result. In general, the code generation process can detect when overflow is not possible. In this case, the code generator does not produce saturation code.

Programmatic Use

Block Parameter: SaturateOnIntegerOverflow
Type: character vector
Values: 'off' | 'on'
Default: 'off'

Block Characteristics

Data Types

double | single | base integer | fixed point | enumerated

Direct Feedthrough

No

Multidimensional Signals

Yes

Variable-Size Signals

No

Zero-Crossing Detection

No

More About

expand all

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.

Fixed-Point Conversion
Convert floating-point algorithms to fixed point using Fixed-Point Designer™.

Introduced in R2011a