Create a run, add data to it, and then view the data in the active tab of the Simulation Data Inspector.
Create Data for Run
Create two timeseries objects to contain data for a sine signal and a cosine signal. Give each timeseries object a descriptive name.
Create Run and Add Data
To open the Simulation Data Inspector, use Simulink.sdi.view.
To import data into the Simulation Data Inspector from the workspace, create a Simulink.sdi.Run object using Simulink.sdi.Run.create. Add metadata information using the Name and Description properties of the Run object.
Add the data you created in the workspace to the empty run.
0.091530s wall, 0.156250s user + 0.031250s system = 0.187500s CPU (204.9%)
Plot Data in Simulation Data Inspector
To access the Simulink.sdi.Signal object corresponding to each signal, use getSignalByIndex. You can use the Simulink.sdi.Signal object properties to specify the line style and color for the signal and plot the signal in the Simulation Data Inspector. For example, specify the LineColor and LineDashed properties for each signal.
To configure a 2-by-1 subplot layout in the active tab of the Simulation Data Inspector plotting area, use Simulink.sdi.setSubPlotLayout. To plot the sine signal on the upper subplot and the cosine signal on the lower subplot, use plotOnSubPlot.
Inspect Data Using Cursors
To access the value of a signal at a specific time, you can add a cursor to the plot. For example, the Sine signal appears to have a local maximum at about 6 seconds. Add one cursor to the plot and observe the signal value at 6 seconds.
To measure the time difference between two points or extract descriptive statistics within the defined interval, add two cursors.
Determine the local maximum sample value in the Sine signal between the cursors using the max function.
Close Simulation Data Inspector and Save Data
When you finish inspecting the plotted signal data, you can close the Simulation Data Inspector and save the session to an MLDATX file.