This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Create Procedures

What Is a Procedure?

A procedure is a series of checks. The checks in a procedure depend on passing the previous checks. If Check A is the first check in a procedure and Check B follows, the Model Advisor does not run Check B until Check A passes. Checks A and B can be either custom or provided by MathWorks®.

You create procedures with the ModelAdvisor.Procedure class API. You first add the checks to tasks, which are wrappers for the checks. The tasks are added to procedures.

When creating procedural checks, be aware of potential conflicts with the checks. Verify that it is possible to pass both checks.

Create Procedures Using the Procedures API

You use the ModelAdvisor.Procedure class to create procedural checks.

  1. Add each check to a task using the ModelAdvisor.Task.setCheck method. The task is a wrapper for the check. You cannot add checks directly to procedures.

  2. Add each task to a procedure using the ModelAdvisor.Procedure.addTask method.

Define Procedures

You define procedures in a procedure definition function that specifies the properties of each instance of the ModelAdvisor.Procedure class. Define one instance of the procedure class for each procedure that you want to add to the Model Advisor. Then register the procedure using the ModelAdvisor.Root.register method.

Add Subprocedures and Tasks to Procedures

You can add subprocedures or tasks to a procedure. The tasks are wrappers for checks.

  • Use the ModelAdvisor.Procedure.addProcedure method to add a subprocedure to a procedure.

  • Use the ModelAdvisor.Procedure.addTask method to add a task to a procedure.

Define Where Procedures Appear

You can specify where the Model Advisor places a procedure using the ModelAdvisor.Group.addProcedure method.

Procedure Definition

The following code example adds procedures to a group:

%Create three procedures

%Create a group
MAG = ModelAdvisor.Group('com.mathworks.sample.myGroup');

%Add the three procedures to the group
addProcedure(MAG, MAP1);
addProcedure(MAG, MAP2);
addProcedure(MAG, MAP3);

%register the group and procedures
mdladvRoot = ModelAdvisor.Root;

The following code example adds subprocedures to a procedure:

%Create a procedure
MAP = ModelAdvisor.Procedure('com.mathworks.example.Procedure');

%Create 3 sub procedures

%Add sub procedures to procedure
addProcedure(MAP, MAP1);
addProcedure(MAP, MAP2);
addProcedure(MAP, MAP3);

%register the procedures
mdladvRoot = ModelAdvisor.Root;

The following code example adds tasks to a procedure:

%Create three tasks

%Create a procedure
MAP = ModelAdvisor.Procedure('com.mathworks.tasksample.myProcedure');

%Add the three tasks to the procedure
addTask(MAP, MAT1);
addTask(MAP, MAT2);
addTask(MAP, MAT3);

%register the procedure and tasks
mdladvRoot = ModelAdvisor.Root;

See Also

| | | |

Related Examples

More About