Model Export to MATLAB®
When you export a model to MATLAB®, for each model/output, an M script is created that makes a model prediction.
This M script does not use ASCMO code and is therefore independent of an ASCMO installation. However, an installed MATLAB environment is a prerequisite for exporting to MATLAB.
In the export dialog you can choose what to export.
For a model output named Y1 and the base name predict, the script predict_Y1.m is created.
The call is as follows: y = predict_Y1(x).
x is a vector of length equal to the number of inputs. The function returns a scalar, the model prediction.
With 4 inputs and output named Y1.
>> x = [0.3 7.5 100 66.1];
>> y = predict_Y1(x)
>> y =
>> 0.503
You can also enter a matrix in which the number of columns corresponds to the number of inputs. Each row corresponds to an input value to the model. The output is a vector whose ith component is the model prediction for the ith row (input value).
Note |
---|
If MATLAB® and Simulink® are not installed on your computer, you can export the model to a MATLAB® script (*.m) via File > Export Model > Simulink Script. This script can later be used to create a Simulink model. |
See also