Determine whether a run ID is valid
This example shows how to check whether a run ID is valid. You can use
Simulink.sdi.isValidRunID to ensure you have valid data throughout your script.
Create a Simulation Run
Simulate the model
sldemo_fuelsys to create a run in the Simulation Data Inspector, and use
Simulink.sdi.getAllRunIDs to get its run ID.
% Simulate model load_system('sldemo_fuelsys') sim('sldemo_fuelsys') % Get run ID runIDs = Simulink.sdi.getAllRunIDs; runID = runIDs(end);
Check Run ID Validity
Check to verify that the Simulation Data Inspector has a run corresponding to the run ID.
ans = logical 1
Delete the Run and Check Validity
You can delete runs to clear out memory space or clean up the Simulation Data Inspector UI. When you delete a run, the run ID for that run becomes invalid.
ans = logical 0
valid— Run validity indicator
Run validity indicator. When
runID is valid. When
runID is invalid.