Main Content

slEditToolstripCommand

Open file that defines custom Simulink Toolstrip command

Since R2021b

Description

example

slEditToolstripCommand(action) opens the file that defines the custom Simulink® Toolstrip command.

For scripts, the file that defines the action also defines the command. When you set commandType to Script, the command property directly specifies the script. When you set the command property to the name of a script on the MATLAB® path, the function opens the JSON file, not the referenced MATLAB script.

Examples

collapse all

Suppose you have many files that define commands for a custom tab in a toolstrip component named custom.

To open the file that defines a command for an action, such as myAction, use the slEditToolstripCommand function.

slEditToolstripCommand("custom:myAction");

Input Arguments

collapse all

Fully qualified action name, specified as a character vector or string scalar. The fully qualified name is the name of the toolstrip component followed by a colon and the full path to the action within the toolstrip component.

When an action is defined at the top level of a toolstrip component, the fully qualified action name consists of these parts:

  1. Name of the toolstrip component followed by a colon

  2. Action ID

When an action is defined in the JSON object for a control, the action does not use an action ID. The fully qualified action name consists of these parts:

  1. Name of the toolstrip component followed by a colon

  2. Tab ID followed by a forward slash

  3. Section ID or index followed by a forward slash

  4. Column ID or index followed by a forward slash

  5. Control ID or index

Example: slEditToolstripCommand("custom:myAction") opens the file that defines myAction for the custom toolstrip component.

Example: slEditToolstripCommand("custom:customTab/2/1/3") opens the file that defines the command for the third control in the first column of the second section on the tab named customTab in the custom toolstrip component.

Data Types: char | string

Version History

Introduced in R2021b