You are on page 1of 3

Exporting data from Simulink to Matlab workspace

Step 1)
In the Simulink model, select MODELING tab, and then click on “Model Settings”

Step 2)
Select Data Import/Export , and uncheck the “Single simulation output” box
Step 3)
Double click on the scope for the signal that will be exported to Matlab workspace

Step 4)
Open Configuration Properties
Step 5)
Select the Logging tab, check “Log data to workspace” check box and specify the variable name
that will be used in Matlab workspace. Select “Array” as the save format. Also, variable
decimation can be specified. Larger the decimation is, less data points will be saved. Decimation
should be kept between 1 and 10.

Step 6)
Aafter the model is run, all variables logged by scopes in Simulink (configured in step 5) are
available in Matlab workspace. Each variable is a two column arrays where the first column is
time and second is the actual quantity captured by the scope.
The following command plots the data:
plot(Ia(:,1),Ia(:,2),'LineWidth',2),grid
Ia(:,1) – first column of the Ia array (time)
Ia(:,2) – second column of the Ia array (actual current Ia)
Step 7)
The figure can be copied and pasted in a Word (or any other) document. Select Edit->Copy
Figure, to copy the figure to clipboard.

You might also like