delete (any object)

Delete SimBiology object




Objabstract kinetic law, configuration set, event, kinetic law, model, parameter, reaction, rule, SimData, species, unit, unit prefix, or variant object.


delete(Obj) removes an object (Obj) from its parent.

  • If Obj is a model object, the model is deleted from the root object. delete removes all references to the model both at the command line and in the SimBiology® desktop.

  • If Obj is a species object that is being used by a reaction object, this method returns an error and the species object is not deleted. You need to delete the reaction or remove the species from the reaction before you can delete the species object.

  • If Obj is a parameter object being used by a kinetic law object, there is no warning when the object is deleted. However, when you try to simulate your model, a error occurs because the parameter cannot be found.

  • If Obj is a reaction object, this method deletes the object, but the species objects that were being used by the reaction object are not deleted.

  • If Obj is an abstract kinetic law object and there is a kinetic law object referencing it, this method returns an error.

  • If Obj is a SimBiology configuration set object, and it is the active configuration set object, this method, after deleting the object, makes the default configuration set object active. Note that you cannot delete the default configuration set.

  • You cannot delete the SimBiology root.

You can also delete all model objects from the root with one call to the sbioreset function.


Example 1

Delete a reaction from a model. Notice the species objects are not deleted with the reaction object.

modelObj = sbiomodel('cell');
reactionObj = addreaction(modelObj, 'a -> b');

Example 2

Delete a single model from the root object.

modelObj1 = sbiomodel('cell');
modelObj2 = sbiomodel('virus');

Introduced in R2006a