MATLAB System

Include System object in model

Library

User-Defined Functions

Description

The MATLAB System block brings existing System objects (based on matlab.System) into Simulink®. It also enables you to use System object authoring APIs to develop new blocks for Simulink.

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). The MATLAB System block supports only a subset of the functions available in MATLAB. See Functions and Objects Supported for C and C++ Code Generation — Alphabetical List for a complete list of functions. These functions include those in common categories, such as:

System Objects

To use the MATLAB System block, you must first have a new System object™ or use an existing one. For more information, see System Object Integration.

Data Type Support

The MATLAB System block accepts inputs of most types that Simulink supports. It does not support enumerated data types or buses. For more information, see Data Types Supported by Simulink.

For information on fixed-point support for this block, see Code Acceleration and Code Generation from MATLAB.

The MATLAB System block supports Simulink frames. For more information, see Sample- and Frame-Based Concepts.

Parameters and Dialog Box

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 clicking New.

After you save the System object, you can enter the name in the System object name text 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

See Block-Specific Parameters for 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 select New > System Object > Simulink Extension.

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

Settings

Default: Basic

Command-Line Information

See Block-Specific Parameters for 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 for MATLAB System block 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 is Code generation, system objects accept a maximum of nine 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 every MATLAB System block. You cannot remove it.

  • If the block has no tabs, this parameter appears at 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.

Characteristics

Direct Feedthrough

Yes

Sample Time

Inherited

Dimensionalized

Yes

Multidimensionalized

Yes

Zero-Crossing Detection

No

Was this topic helpful?