Stateflow    

ml Data Type

Stateflow data of type ml is typed internally with the MATLAB type mxArray. This means that you can assign (store) any type of data available in Stateflow to a data of type ml. This includes any type of data defined in Stateflow or returned from MATLAB with the ml namespace operator or ml function.

The following features and limitations apply to Stateflow data of type ml.

Place Holder for Workspace Data

Both the ml namespace operator and the ml function can access data directly in the MATLAB workspace and return it to Stateflow. However, maintaining data in the MATLAB workspace can present Stateflow users with conflicts with other data already resident in the workspace. Consequently, with the ml data type, you can maintain ml data in Stateflow and use it for MATLAB computations in Stateflow action language.

As an example, in the following Stateflow action language statements, mldata1 and mldata2 are Stateflow data of type ml:

In the first line of this example, mldata1 receives the return value of the rand function in MATLAB, which, in this case, returns a 3-by-3 array of random numbers. Note that mldata1 is not specified as an array or sized in any way. It can receive any MATLAB workspace data or the return of any MATLAB function because it is defined as a Stateflow data of type ml.

In the second line of the example, mldata2, also of Stateflow data type ml, receives the transpose matrix of the matrix in mldata1. It is assigned the return value of the MATLAB function transpose in which mldata1 is the argument.

Note the differences in notation if the preceding example were to use MATLAB workspace data (wsdata1 and wsdata2) instead of Stateflow ml data to hold the generated matrices:

In this case, each workspace data must be accessed through the ml namespace operator.


  Which ml Should I Use? Inferring Return Size for ml Expressions