Use the toolbar icons to customize the appearance of the MATLAB Function Block Editor in the same manner as the MATLAB® editor. See Desktop.
Use the following tools to work with the MATLAB Function block:
Opens the Ports and Data Manager dialog to add or modify arguments for the current MATLAB Function block. To learn more, see Ports and Data Manager.
Opens the MATLAB function report for the MATLAB Function block. For more information, see MATLAB Function Reports.
Opens the Simulation Target pane in the Configuration Parameters dialog to include custom code.
Go To Diagram
Displays the MATLAB function in its native diagram without closing the editor.
See Define Inputs and Outputs for an example of defining an input argument for a MATLAB Function block.
To indent a block of code manually:
Highlight the text that you would like to indent.
Select one of the Indent tools on the Editor tab:
|Applies smart indenting to selected text.|
|Move selected text right one indent level.|
|Move selected text left one indent level.|
You can open a local function, function, file, or variable from within a file in the MATLAB Function Block Editor.
To open a selection:
Position the cursor in the name of the item you would like to open.
Right-click and select Open <selection> from the context menu.
The Editor chooses the appropriate tool to open the selection. For more information, refer to Manage Files and Folders.
If you open a MATLAB Function block input or output parameter, the Ports and Data Manager opens with the selected parameter highlighted. You can use the Ports and Data Manager to modify parameter attributes. For more information, refer to Ports and Data Manager.
You can use the Evaluate a Selection menu option to report the value for a MATLAB function variable or equation in the MATLAB window during simulation.
To evaluate a selection:
Highlight the variable or equation that you would like to evaluate.
Hold the mouse over the highlighted text and then right-click and select Evaluate Selection from the context menu. (Alternatively, select Evaluate Selection from the Text menu).
When you reach a breakpoint, the MATLAB command Window displays the value of the variable or equation at the Command Line Debugger prompt.
debug>> stdev 1.1180 debug>>
You cannot evaluate a selection while MATLAB is busy, for example, running a MATLAB file.
To set the data scope of a MATLAB Function block input parameter:
Highlight the input parameter that you would like to modify.
Hold the mouse over the highlighted text and then right-click and select Data Scope for <selection> from the context menu.
Input if your input data is provided by the Simulink® model via an input port to the MATLAB Function block.
Parameter if your input is a variable of the same name in the MATLAB or model workspace or in the workspace of a masked subsystem containing this block.
For more information, refer to Setting General Properties.