Main Content

simbio.diagram.joinBlock

Combine copies of SimBiology species block in diagram

Since R2021a

Description

simbio.diagram.joinBlock combines cloned blocks of a species block into one block in SimBiology Model Builder.

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

simbio.diagram.joinBlock(speciesObj) combines all copies of the SimBiology species speciesObj block into one block in the model diagram. speciesObj must be scalar.

example

simbio.diagram.joinBlock(speciesObj,exprObj) combines all copies of the species speciesObj block into one block and keeps the block that is connected to the expression object exprObj in the diagram. Both speciesObj and exprObj must be scalar.

simbio.diagram.joinBlock(speciesObj,exprObj1,exprObj2) combines cloned species blocks connected to the expression objects exprObj1 and exprObj2 into one block. speciesObj, exprObj1, and exprObj2 must be scalar.

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 references the species Gbg. 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.

Expression object, specified as a Reaction or Rule object. The rule object can be a rate rule or repeated assignment rule. exprObj must be a scalar.

Expression object, specified as a Reaction or Rule object. The rule object can be a rate rule or repeated assignment rule. exprObj1 must be a scalar.

Expression object, specified as a Reaction or Rule object. The rule object can be a rate rule or repeated assignment rule. exprObj2 must be a scalar.

Version History

Introduced in R2021a