Contents

Simulink.sdi.isValidRunID

Determine if run ID is valid

Syntax

isValid = Simulink.sdi.isValidRunID(runID)

Description

isValid = Simulink.sdi.isValidRunID(runID) returns true if the run ID, runID, corresponds to a run currently in the Simulation Data Inspector. Otherwise, it returns false.

Input Arguments

runID

Run ID, a unique number identifying a run in the Simulation Data Inspector.

Output Arguments

isValid

Boolean value: true, if the run exists; false, otherwise.

Examples

Before comparing the simulation data of two runs, you can verify that the run IDs are valid.

 % Configure model "slexAircraftExample" for logging and simulate
simOut = sim('slexAircraftExample', 'SaveOutput','on', ...
             'SaveFormat', 'StructureWithTime', ...
             'ReturnWorkspaceOutputs', 'on');
 
% Create a Data Inspector run
run1ID = Simulink.sdi.createRun('First Run', 'base', {'simOut'});
run2ID = Simulink.sdi.createRun('Second Run', 'base', {'simOut'});

% Check if run IDs are valid in Simulation Data Inspector
run1ID_valid = Simulink.sdi.isValidRunID(run1ID);
run2ID_valid = Simulink.sdi.isValidRunID(run2ID);

if run1ID_valid & run2ID_valid
% Compare two runs
   difference = Simulink.sdi.compareRuns(run1ID, run2ID);
end
Was this topic helpful?