MATLAB Simulink - Export Data



In this chapter, we will learn how to use Simulink output results inside MATLAB. Let us try a simple model of sine wave as shown below −

MATLABS

When we run the model, the scope displays the sine wave as shown below −

Configuration

Now to get the data of the sine wave, go to the configuration properties and select logging tab.

CP Scope

Select the log data to workspace checkbox, as shown below −

Logdata

Set the variable name of your choice. Here, we have given the name as swave and the save format as Array. Click on OK button and run the simulation again.

You should see the output in the workspace

Array

Double click and it will show you the details of the swave variable which we saved earlier.

Swave

Inside command prompt type out .swave and it will give you the output as shown below −

Out Swave

You can plot the sine wave using plot command as shown below −

Command Window

The graph is shown as follows −

Graph
Advertisements