Adding Actions

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

See Also
Defining Mappings
Defining Commands
  1. From the Applications section of the action bar, click MATLAB and drop it on the process diagram.
  2. Double-click MATLAB .
    The MATLAB Editor appears.
  3. From the MATLAB Editor, click the Contents tab.
  4. Determine when you want to perform actions:
    OptionDescription
    Initialize Perform actions only the first time that the MATLAB adapter runs within a job. This option is useful for initializing/creating variables or loading functions one time at the beginning of the MATLAB session.
    Execution Order Perform actions every time the MATLAB adapter runs. By default, the MATLAB adapter starts with three predefined actions in the Execution Order phase:
    • Input Mappings for defining mappings from Optimization Process Composer parameter values to MATLAB variables.
    • Commands for defining the command to run.
    • Output Mappings for mapping MATLAB variable values back to Optimization Process Composer parameters.
    Finalize Perform actions only when the MATLAB session is shutting down. Because the adapter 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 Optimization Process Composer is cleaning up persistent adapters.

    Warning: Optimization Process Composer 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.

  5. Click the tab that corresponds to the phase for which you want to create actions.
  6. Click Add mapping action or Add command action, depending on the type of action you want to create.

    The MATLAB adapter 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:

    OptionDescription
    Use? Specifies whether or not this action runs. 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.
  7. Use the up and down arrows located below the table to change the order of the actions.

    You can delete actions by clicking X .

  8. If necessary, edit the details of any action by selecting it in the table and using the panel on the right side of the editor.
  9. Click Ok to save your changes and to close the MATLAB Editor.