MATLABFunctionConfiguration

Configure MATLAB Function block properties programmatically

Description

The MATLABFunctionConfiguration object controls the MATLAB Function block properties such as description, sample time, and the function script. You can create a configuration object using get_param and change the property values of the object using dot notation.

Creation

myMFBConfigobj = get_param(gcb, 'MATLABFunctionConfiguration') creates a MATLAB Function block configuration object for the selected MATLAB Function block.

Properties

expand all

Display the path of the MATLAB Function block relative to the model.

Data Types: char

Display the script for the MATLAB Function block.

Data Types: char

Update method of the block, specified as an enumerated string.

Specify an UpdateMethod using one of these values:

  • Inherited — Input to the MATLAB Function block determines when the block is updated during a simulation. The input is explicitly triggered by a signal on its trigger port originated from a connected Simulink® block. If the UpdateMethod is changed to the 'Inherited', the sample time automatically sets to -1.

  • Discrete — Simulink model generates an implicit event at regular time intervals to awaken the block at the rate you specify in the SampleTime property. Other blocks in the model can have different sample times.

  • Continuous — The MATLAB Function block updates at major time steps only, although it computes outputs and local continuous variables during minor and major time steps. If the UpdateMethod is changed to 'Continuous', the sample time automatically sets to 0.

When you set the UpdateMethod to Inherited or Continuous and attempt to change SampleTime, Simulink displays a warning and ignores the input sample time.

UI Use

Open the Ports and Data Manager and change the Update Method to the method you choose.

Data Types: enumerated

Change the sample time of the MATLAB Function block. Sample time is only valid when the UpdateMethod is set to Discrete. If the UpdateMethod is set to 'Continuous' or 'Inherited', any changes made to the sample time are ignored.

UI Use

Open the Ports and Data Manager and change the Sample Time.

Data Types: char

Description of the block, specified as a character vector.

UI Use

Open the Ports and Data Manager and change the Description to the text you choose.

Data Types: char

Documentation link for the block, specified as a character vector.

UI Use

Open the Ports and Data Manager and change the Document Link to your block documentation link.

Data Types: char

Specify whether the simulation supports variable input and output data dimensions.

UI Use

Open the Ports and Data Manager and check the Support variable-size arrays to turn this setting on.

Data Types: logical

Display or change whether the block has direct feedthrough. The block is considered to have direct feedthrough if the output of the block directly depends on the input of the block. The block does not have direct feedthrough if the outputs of the block depend on the internal states and properties rather than the input of the block.

UI Use

Open the Ports and Data Manager and check the Allow direct feedthrough to turn this setting on.

Data Types: logical

Specify whether the integer overflow saturates. If this setting is set to true, the overflows saturate to either the minimum or maximum value that the data type can represent. If the setting is false, the overflow wraps to the appropriate value that the data type can represent. If your model has a possible overflow, and you want to apply saturation protection in your generated code, it is recommended to have this setting on. If you have performance restrictions, and not concerned with the integer overflow, you can set this property to false.

UI Use

Open the Ports and Data Manager and check the Saturate on integer overflow box to turn this setting on.

Data Types: logical

Specify which data types to treat as fi data types. To learn more about fi objects, see fi Object Properties (Fixed-Point Designer).

UI Use

Open the Ports and Data Manager and select an option from the Treat these inherit Simulink signal types as fi objects menu.

Data Types: string

Specify which fixed-point math settings to use. You can use the current MATLAB® fixed-point math settings, or you can enable the edit box to specify the desired fixed-point math settings. To learn more about fixed-point math, see fimath (Fixed-Point Designer).

UI Use

Open the Ports and Data Manager and choose from the MATLAB Function fimath settings.

Data Types: string

Specify the fimath construction function you want to use. fimath(...'PropertyName',PropertyValue...) allows you to set the attributes of a fimath object using property name/property value pairs. To learn more fimath object properties, see fimath Object Properties (Fixed-Point Designer).

UI Use

Open the Ports and Data Manager and edit the MATLAB Function fimath box with the appropriate fimath expression.

Data Types: string

Examples

Create a MATLAB Function Block Configuration Object

This example creates a MATLAB Function block configuration object using the 'sldemo_radar_eml' model.

open_system('sldemo_radar_eml')
myMFBConfig = get_param('sldemo_radar_eml/MATLAB Function','MATLABFunctionConfiguration');
myMFBConfig.Description = 'Radar data processing tracker using Extended Kalman';
Introduced in R2019b