Get the Simulation Data Inspector rule for naming runs
returns the run naming rule as a character vector. The run naming rule can contain
one or more tokens that update for each run, for example,
namingRule = Simulink.sdi.getRunNamingRule
<run_index>. The run naming rule applies to runs
automatically created through simulating a model in Simulink®.
Modify Run Naming Rule Then Restore Default
This example shows how to use the Simulation Data Inspector API to modify the Simulation Data Inspector run naming rule, check a run's name, restore default preferences, and check the run naming rule.
% Load model load_system('sldemo_fuelsys') % Modify run naming rule Simulink.sdi.setRunNamingRule('<model_name> Run <run_index>') % Simulate system sim('sldemo_fuelsys') % Check run name runIDs = Simulink.sdi.getAllRunIDs; runID = runIDs(end); fuelRun = Simulink.sdi.getRun(runID); fuelRun.name
ans = 'sldemo_fuelsys Run 1'
% Clear preferences to reset the run naming rule Simulink.sdi.clearPreferences % Check run naming rule Simulink.sdi.getRunNamingRule
ans = 'Run <run_index>: <model_name>'
namingRule — Naming rule for Simulation Data Inspector runs
Character vector that specifies the naming rule the Simulation Data Inspector uses to name the runs automatically created through simulating a Simulink model. The run naming rule can contain any of the following tokens that represent information pulled for each run:
<run_index>– Run's index in the Simulation Data Inspector repository.
<model_name>– Name of the model simulated to create the run.
<time_stamp>– Start time for the simulation that created the run.
<sim_mode>– Simulation mode used for the simulation that created the run.
You can view the run naming rule using the Simulation Data Inspector UI. You can find the New Run options under the Simulation Data Inspector Preferences menu.