To define structure parameters in MATLAB Function blocks, follow these steps:
Define and initialize a structure variable
A common method is to create a structure in the base workspace.
In the Ports and Data Manager, add data in the MATLAB Function block with the following properties:
Property | What to Specify |
---|---|
Name | Enter same name as the structure variable you defined in the base workspace |
Scope | Select Parameter |
Tunable | Leave checked if you want to change (tune) the value of the parameter during simulation; otherwise, clear to make the parameter nontunable and preserve the initial value during simulation |
Type | Select Inherit: Same as Simulink |
Click Apply.
FIMATH properties for nontunable structure parameters containing fixed-point values are based on the initial values of the structure. They do not come from the FIMATH properties specified for fixed-point input signals to the parent MATLAB Function block. (These FIMATH properties appear in the properties dialog box for MATLAB Function blocks.)