Parameter arguments for MATLAB Function blocks 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 the MATLAB Function block 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 the MATLAB Function block. Creating a mask for a block allows you to define the access for each parameter.
In the MATLAB Function Block Editor, add an argument to the function header of the MATLAB Function block. The name of the argument must match the name of the masked parameter or MATLAB variable that you want to pass to the MATLAB Function block.
The new argument appears as an input port on the MATLAB Function block in the model.
In the MATLAB Function Block Editor, click Edit Data.
Select the new argument.
Set Scope to
The input port for the parameter argument no longer appears in the MATLAB Function block.
Parameter arguments appear as arguments in the function header of the MATLAB Function block to maintain MATLAB consistency. As a result, you can test functions in a MATLAB Function block by copying and pasting them to MATLAB.