Adding Actions

Before you begin using the MATLAB component, you must specify actions (mappings or commands) and determine when you want each action take place.

  1. Double-click the MATLAB component icon .

    The MATLAB Component Editor appears.

  2. From the MATLAB Component Editor, click the Contents tab.

  3. Determine when you want to execute actions:

    Option Description
    Initialize Execute actions only the first time that the MATLAB component executes within a job (model execution). This option is useful for initializing/creating variables or loading functions one time at the beginning of the MATLAB session.
    Execution Order Execute actions every time the MATLAB component executes. By default, the MATLAB component starts with three predefined actions in the Execution Order phase:
    • Input Mappings for defining mappings from Isight parameter values to MATLAB variables.
    • Commands for defining the command to execute.
    • Output Mappings for mapping MATLAB variable values back to Isight parameters.
    Finalize Execute actions only when the MATLAB session is shutting down. Because the component can be configured to leave MATLAB open after the job completes, these actions might not get run at the end of the job but may instead be invoked later when Isight is cleaning up persistent components.

    Warning: Isight provides a scratch directory for MATLAB to use during the Initialize and Execution Order phases but not during the Finalize phase. You should not assume that your Finalize command’s current directory setting in MATLAB refers to a usable directory. You can disregard this warning if the MATLAB component is configured to always run in a fixed directory.

  4. Click the tab that corresponds to the phase for which you want to create actions.

  5. Click the Add Action button.

    The Action Type Selection dialog box appears.

  6. Click Mapping or Command, depending on the type of action you want to create. For more information, see Defining Mappings or Defining Commands.

  7. Click OK.

    The MATLAB component creates a new action of the specified type and displays it in the table on the tab.

    The table presents the following information for each action:

    Option Description
    Use? Specifies whether or not this action executes. You can select this option to turn actions on and off as needed.
    Type Specifies if the action is a mapping or a command.
    Identifier A unique name identifying the action. You can modify this identifier directly in the table.

  8. Use the and arrows located below the table to change the order of the actions.

    You can delete actions by clicking the button.

  9. If necessary, edit the details of any action by selecting it in the table and using the panel on the right side of the component editor.

    For more information, see Defining Mappings or Defining Commands.

  10. Click OK to save your changes and to close the MATLAB Component Editor.