Documentation

MATLAB System

IncludeSystem objectin model

Library

User-Defined Functions

Description

TheMATLAB Systemblock brings existing System objects (based onmatlab.System) into Simulink®. It also enables you to use System object APIs to develop new blocks for Simulink. For more information on this block, seeMATLAB System Block.

For interpreted execution, the model simulates the block using the MATLAB®execution engine.

For code generation, the model simulates the block using code generation (using the subset of MATLAB® code supported for code generation). TheMATLAB Systemblock supports only a subset of the functions available in MATLAB. SeeFunctions and Objects Supported for C/C++ Code Generation — Alphabetical Listfor a complete list of functions. These functions include those in common categories, such as:

System Objects

To use theMATLAB Systemblock, you must first have a new System object™ or use an existing one. For more information, seeSystem Object Integration.

Data Type Support

TheMATLAB Systemblock accepts inputs of most types that Simulink supports. It does not support virtual buses as input or output. It does not support nonvirtual buses that contain variable-size signals. For more information, seeData Types Supported by Simulink.

For information on fixed-point support for this block, seeCode Acceleration and Code Generation from MATLAB(Fixed-Point Designer).

TheMATLAB Systemblock supports Simulink frames. For more information, seeSample- and Frame-Based Concepts(DSP System Toolbox).

Parameters

System object name

Specify the full name of the user-defined System object class without the file extension. This entry is case sensitive. The class name must exist on the MATLAB path.

You can specify a System object name in one of these ways:

  • Enter the name in the text box.

  • Click the list arrow attached to the text box. If valid System objects exist in the current folder, the names appear in the list. Select a System object from this list.

  • Browse to a folder that contains a valid System object. If the folder is not on your MATLAB path, the software prompts you to add it.

If you need to create a System object, you can create one from a template by clickingNew.

After you save the System object, the name appears in theSystem object nametext box.

Settings

Default:None

Tips

Use the full name of the user-defined System object class name. The block does not accept a MATLAB variable that you have assigned to a System object class name.

Command-Line Information

SeeBlock-Specific Parametersfor the command-line information.

New

Click this button to create a System object from a template.

Select one of these options.

  • Basic

    Starts MATLAB Editor and displays a template for a simple System object using the fewest System object methods.

  • Advanced

    Starts MATLAB Editor and displays a template for a more advanced System object using most of the System object methods.

  • Simulink Extension

    Starts MATLAB Editor and displays a file that contains utilities for customizing the block for Simulink. This is the same file available in MATLAB when you selectNew>System Object>Simulink Extension.

After you save the System object, you can enter the name in theSystem object nametext box.

Settings

Default:Basic

Command-Line Information

SeeBlock-Specific Parametersfor the command-line information.

Simulate using

Select the simulation mode.

Settings

Default:Code generation

Code generation

On the first model run, simulate and generate code forMATLAB Systemblock using only MATLAB functions supported for code generation. If the structure of the block does not change, subsequent model runs do not regenerate the code.

If the simulation mode isCode generation, system objects accept a maximum of 32 inputs.

Interpreted execution

Simulate model using all supported MATLAB functions. Choosing this option can slow simulation performance.

Dependency

After you assign a valid System object class name to the block, the next time you open the block dialog box, the parameter is visible. This parameter appears for everyMATLAB Systemblock. You cannot remove it.

  • 如果块没有标签,这个参数t the bottom of the dialog box.

  • If the block has multiple tabs, this parameter appears at the bottom of the first tab of the dialog box.

Saturate on integer overflow

Specify whether overflows saturate.

Settings

Default:Off

On

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

For example, an overflow associated with a signed 8-bit integer can saturate to -128 or 127.

Off

Overflows wrap to the appropriate value that the data type can represent.

For example, the number 130 does not fit in a signed 8-bit integer and wraps to -126.

Tips

  • Consider selecting this check box when your model has a possible overflow and you want explicit saturation protection in the generated code.

  • Consider clearing this check box when you want to optimize efficiency of your generated code.

    Clearing this check box also helps you to avoid overspecifying how a block handles out-of-range signals. For more information, seeCheck for Signal Range Errors.

  • 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.

Dependency

This check box appears when you use theshowFiSettingsImplmethod in the System object.

Command-Line Information

Parameter:SaturateOnIntegerOverflow
Type:character vector
Value:'off'|'on'
Default:'off'

Treat these inherited Simulink signal types as fi objects

治疗为fi指定继承的数据类型data types.

Settings

Default:Fixed-point

Fixed-point

Treat fixed-point data types as fi data types.

Fixed-point & Integer

Treat fixed-point and integer data types as fi data types.

Dependency

This check box appears when you use theshowFiSettingsImplmethod in the System object.

MATLAB System fimath

Specify which fixed-point math settings to use.

Settings

Default:Same as MATLAB

Fixed-point

Use the current MATLAB fixed-point math settings.

Specify Other

Enable the edit box for specifying the desired fixed-point math settings. For information on setting fixed-point math, seefimath.

Dependency

This check box appears when you use theshowFiSettingsImplmethod in the System object.

Characteristics

Data Types

Double | Single | Boolean | Base Integer | Fixed-Point

Sample Time

Inherited

Direct Feedthrough

Yes

Multidimensional Signals

Yes

Variable-Size Signals

Yes

Zero-Crossing Detection

No

Code Generation

Yes

Introduced in R2013b

Was this topic helpful?