Main Content

simbio.diagram.splitBlock

Split SimBiology species block in diagram

Since R2021a

Description

simbio.diagram.splitBlock splits a species block so that each expression that references the species is connected to a different copy of the species block in SimBiology Model Builder. The changes are instantly reflected in the app.

Before you run the function at the command line:

  1. Open the corresponding SimBiology® model in the SimBiology Model Builder app.

  2. Export the model from the app to MATLAB® workspace by selecting Export > Export Model to MATLAB Workspace on the Home tab of the app.

You can query and configure only the properties of the objects shown in the Diagram tab of the app. The objects shown in the diagram are compartments, species, reactions, rate rules, repeated assignment rules, and parameters that are on the left-hand side of a rate rule, a repeated assignment rule, or an event function.

example

expr = simbio.diagram.splitBlock(speciesObj) makes copies of a SimBiology species speciesObj block so that each expression that references speciesObj is connected to a different copy of the species block and returns a list of expression objects expr that are connected to speciesObj. Use this function to make the diagram look less cluttered and clearer.

Examples

collapse all

Open the gprotein model in the SimBiology Model Builder app.

simBiologyModelBuilder('gprotein');

The app opens and shows the model in the Diagram tab.

On the Home tab of the app, select Export > Export Model to MATLAB Workspace.

In the SimBiology Model Export dialog, click OK to export the model with the variable name m1.

Go to the MATLAB command line and confirm that the model m1 is in the workspace. Get a list of species of the model.

m1.Species
ans = 

   SimBiology Species Array

   Index:    Compartment:    Name:    Value:       Units:
   1         unnamed         G        7000               
   2         unnamed         Gd       3000               
   3         unnamed         Ga       0                  
   4         unnamed         RL       0                  
   5         unnamed         L        6.022e+17          
   6         unnamed         R        10000              
   7         unnamed         Gbg      3000 

The model diagram already has a copy for each expression that the species Gbg is being referenced. In this case, calling simbio.diagram.splitBlock does not split the block again, but returns the list of expressions that the species is connected to. In this case, Gbg is used in two reactions.

Gbg = m1.Species(7);
expr = simbio.diagram.splitBlock(Gbg)
expr = 

   SimBiology Reaction Array

   Index:    Reaction:              
   1         Gd + Gbg -> G          
   2         G + RL -> Ga + Gbg + RL          

Join all the cloned blocks so that there is only one block for Gbg. In this case, keep the copy of the block that is connected to the G Protein activation reaction (G + RL -> Ga + Gbg + RL). Note that the order of reactions returned in expr can change.

simbio.diagram.joinBlock(Gbg,expr(2))

Input Arguments

collapse all

Species object, specified as a SimBiology Species object. speciesObj must be scalar.

Output Arguments

collapse all

List of expressions that species is connected to, returned as a Reaction, Rule object or array of objects. The rule object can be a rate rule or repeated assignment rule.

Version History

Introduced in R2021a