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.
Simulink.sdi.isValidRunID(runID)
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.
Unique Simulation Data Inspector run identifier, specified as a positive
integer. The Simulation Data Inspector assigns run IDs when it creates runs.
You can get the run ID for your run using Simulink.sdi.getAllRunIDs
or Simulink.sdi.getRunIDByIndex.
Run validity indicator, specified as a numeric or logical
1 (true) or 0
(false). When valid is
true, the runID is valid. When
valid is false, the
runID is invalid.
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window.
Web browsers do not support MATLAB commands.
Sélectionner un site web
Choisissez un site web pour accéder au contenu traduit dans votre langue (lorsqu'il est disponible) et voir les événements et les offres locales. D’après votre position, nous vous recommandons de sélectionner la région suivante : .
Vous pouvez également sélectionner un site web dans la liste suivante :
Comment optimiser les performances du site
Pour optimiser les performances du site, sélectionnez la région Chine (en chinois ou en anglais). Les sites de MathWorks pour les autres pays ne sont pas optimisés pour les visites provenant de votre région.