Main Content

Undo and Redo Model Changes in SimBiology

While a model is open in one (or both) of the SimBiology apps, you can undo and redo model building and diagram configuration actions you take in the apps or at the command line. Model building activities include changes to the model, variants, doses, and configset object (Simulation Settings). Model diagram configuration actions include joining and splitting species blocks, and making changes to block and line properties, such as to block position, block shape, and line color.

Regardless of whether you perform the actions in the apps or at the command line, you can undo them only by using the Undo or Redo button in the SimBiology Model Builder app.

The action history for undo and redo is model-specific. Hence, if you have several models in a project, each model maintains its own list of actions for undoing or redoing. Removing a model from a project clears the action history for that model. Closing both apps clears all the action histories for all models in the project.

Each time you undo or redo, the Model Builder app:

  1. Shows a message in the status bar indicating what the last modification was.

  2. Changes the focus as follows:

    • If a model property or model diagram is changed, the Diagram tab is open and selected.

    • If a variant property is changed, the Variants tab is open and selected.

    • If a dose property is changed, the Doses tab is open and selected.

    • If the change is in the model configset object (or Simulation Settings of the app), the app shows only the message in the status bar and does not change the focus.

Model Changes in Model Analyzer App

You can undo model changes made within the Model Analyzer app. You still need to use the Undo and Redo buttons in the Model Builder app. Specifically, you can undo the following actions originating from the Model Analyzer app:

  • Adding or modifying observables in the Postprocessing: Calculate Observables step

  • Committing slider values for quantities and doses from the Explorer to the model

  • Creating variants from the slider, estimated parameter values, or simulation data

Undo Deletion of Model Components

You can undo and redo the deletion of model components (such as species or parameters) of a model but the deletion of a model object is not supported for undoing and redoing. You can delete a model component by using the Delete key or context menu option in the Model Builder app or by calling the delete function at the command line.

At the command line, if you have a variable referencing a model component that you have deleted, after undoing the deletion, you need to do an additional step to retrieve the model component using dot indexing, get, or sbioselect. This step lets you continue using the variable to update the properties of the model component.

To illustrate this point, consider a model m1 open in the Model Builder app and exported to the MATLAB® workspace. You have a variable s1 referencing a model species and you use s1 to change the species properties, such as its value.

s1 = sbioselect(m1,'Type','species','Name','s1');
s1.Value = 10;
delete(s1);
After the delete call, s1 is displayed as a handle to the deleted species.

>> s1

s1 = 

  handle to deleted Species

Next, you click Undo in the Model Builder app. The species shows up again in the app. However, at the command line, s1 still displays as a handle to the deleted species. You cannot use s1 to change the species properties as before. To retrieve the species, you need to use get, dot indexing, or sbioselect.

% Retrieve the species using dot indexing
s1 = m1.Species(1);
% Or retrieve using sbioselect
s1 = sbioselect(m1,'Type','species','Name','s1');
% Continue using the variable to change the object properties
s1.Units = 'microgram/milliliter';

Note

If you delete the nth model component in the model and undo the deletion, the model component is restored as the nth component.

Actions Not Supported for Undoing or Redoing

You cannot undo or redo the following actions.

  • Removal of a model from a project. You can manually add the model back by importing it from the MATLAB workspace into the app, but you cannot undo or redo changes prior to the removal of the model from the project.

  • Deletion of a model.

  • Configurations for unit, unit prefix, and abstract kinetic law.

  • App-specific configurations, such as Preferences.

  • Diagram configurations not specific to the model, such as zoom level or panning.

See Also

| | | | | | | | | | | | | | | |