Documentation

Simulink.sdi.view

Open Simulation Data Inspector

Syntax

Description

example

Simulink.sdi.view opens the Simulation Data Inspector.

Examples

collapse all

Create a run in the Simulation Data Inspector and open the tool to view the simulation output.

% Configure model "slexAircraftExample" for logging and simulate
simOut = sim('slexAircraftExample', 'SaveOutput','on', ...
             'SaveFormat', 'StructureWithTime', ...
             'ReturnWorkspaceOutputs', 'on');

% Create a run in the Simulation Data Inspector
runID = Simulink.sdi.createRun('My Run','base',{'simOut'});

% See the results in Simulation Data Inspector
Simulink.sdi.view;

Compare two runs and open the tool to view the comparison.

% Configure model "slexAircraftExample" for logging and simulate
simOut = sim('slexAircraftExample', 'SaveOutput','on',...
             'SaveFormat', 'StructureWithTime',...
             'ReturnWorkspaceOutputs', 'on');

% Create a run in the Simulation Data Inspector and get signal IDs
run1ID = Simulink.sdi.createRun('My Run', 'namevalue',...
                                {'simOut'}, {simOut});

% Get and change one of the model parameters in the model workspace
mws = get_param('slexAircraftExample','modelworkspace');
wsMq = mws.evalin('Mq');
mws.assignin('Mq',3*wsMq);

% Simulate again
simOut = sim('slexAircraftExample', 'SaveOutput','on',...
             'SaveFormat', 'StructureWithTime',...
             'ReturnWorkspaceOutputs', 'on');

% Create another another run get signal IDs
run2ID = Simulink.sdi.createRun('New Run', 'namevalue',...
                                 {'simOut'}, {simOut});

% Define alignment algorithms
algorithms = [Simulink.sdi.AlignType.DataSource
              Simulink.sdi.AlignType.BlockPath
              Simulink.sdi.AlignType.SID];

% Compare the two runs
difference = Simulink.sdi.compareRuns(run1ID, run2ID, algorithms);

% See the results in Simulation Data Inspector in the Comparisons pane
Simulink.sdi.view(Simulink.sdi.GUITabType.CompareRuns);

Related Examples

Alternatives

To open the Simulation Data Inspector from the Simulink® Editor toolbar, click the Simulation Data Inspector button .

Introduced in R2011b

Was this topic helpful?