Documentation

Add Parameter Arguments

Parameter arguments forMATLAB Functionblocks do not take their values from signals in the Simulink®model. Instead, Simulink searches up the workspace hierarchy. Simulink first looks in a masked workspace if theMATLAB Functionblock or a parent subsystem is masked. If the value is not found, it next looks in the model workspace and then the MATLAB®base workspace.

You can provide a custom interface for parameters by masking theMATLAB Functionblock. Creating a mask for a block allows you to define the access for each parameter.

  1. In the MATLAB Function Block Editor, add an argument to the function header of theMATLAB Functionblock. The name of the argument must match the name of the masked parameter or MATLAB variable that you want to pass to theMATLAB Functionblock.

    新的参数显示为一个我nput port on theMATLAB Functionblock in the model.

  2. In theMATLAB FunctionBlock Editor, clickEdit Data.

  3. Select the new argument.

  4. SetScopetoParameterand clickApply.

    The input port for the parameter argument no longer appears in theMATLAB Functionblock.

Note

Parameter arguments appear as arguments in the function header of theMATLAB Functionblock to maintain MATLAB consistency. As a result, you can test functions in aMATLAB Functionblock by copying and pasting them to MATLAB.

Related Topics

Was this topic helpful?