plot

Class: Simulink.SimulationData.Dataset
Package: Simulink.SimulationData

Plot data in the Simulation Data Inspector

Syntax

plot(ds)
plot(ds,viewer)
runObj = plot(ds)

Description

plot(ds) plots the data in the Simulink.SimulationData.Dataset or Simulink.SimulationData.DatasetRef in the Simulation Data Inspector. When there are eight signals or fewer in the Dataset or DatasetRef object, the Simulation Data Inspector plot layout changes to 1-by-n, where n is equal to the number of signals, and plots one signal on each subplot. When the Dataset or DatasetRef object contains more than eight signals, the Simulation Data Inspector plot layout changes to 1-by-1 and plots the first signal.

plot(ds,viewer) displays the plot in the Simulation Data Inspector or Signal Preview window, according to the value specified for viewer.

runObj = plot(ds) plots the data in the Dataset object and returns the corresponding Simulink.sdi.Run object.

Input Arguments

expand all

Dataset or DatasetRef object that contains the data to plot.

Specify the viewer used to plot the data. By default, the plot function plots data in the Simulation Data Inspector. When you specify 'preview', the data displays in a read-only plot in the Signal Preview window.

Output Arguments

expand all

Simulink.sdi.Run object corresponding to the plotted data. When you view data in a Signal Preview window, the plot function returns empty ([]).

Examples

expand all

Create a timeseries object ts and add elements to plot in the Simulation Data Inspector.

% Create a timeseries object
ts = timeseries([0;20],[0;10]);            
% Create a SimulationData.Dataset
ds = Simulink.SimulationData.Dataset();
% Place timeseries object in dataset
ds = ds.addElement(ts,'ts');
% Plot the element
plot(ds);

Compatibility Considerations

expand all

Not recommended starting in R2019b

Introduced in R2016b