Main Content


Show algebraic loop


ashow returns a list of algebraic loops in the current model.

ashow gcb returns the algebraic loop containing the currently selected block.

ashow s:b returns the algebraic loop containing block b in system s

ashow s#n returns the nth algebraic loop in the system s

ashow clear removes algebraic loop highlighting in the current model


collapse all

This example shows you how to find algebraic loops and step through a simulation in the Simulink Debugger.

Highlight algebraic loops during debugging

Open the ex_sldemo_hydcyl model Start the Simulink debugger. Select Debug > Breakpoints List > Debug Model from the toolstrip. You can also start the debugger from the MATLAB command line using sldebug


Run the debugger. In the MATLAB command prompt, enter:

Found 1 Algebraic loop(s): 
System number#Algebraic loop id, number of blocks in loop
- 0#1, 9 blocks in loop

The ashow command returns the algebraic loops in the model as well as the number of blocks contained within.

Find algebraic loops containing selected block

Select any nonvirtual block in the model. For example, select the PlotResults block, which is a Scope block.

In the MATLAB command prompt, enter

ashow gcb
Block sldemo_hydcyl/PlotResults isn't in an algebraic loop.

The PlotResults block does not belong in any algebraic loop.

In the MATLAB command prompt, enter

ashow gcb
- sldemo_hydcyl/Valve//Cylinder//Piston//Spring Assembly/Control Valve Flow/IC
- sldemo_hydcyl/Valve//Cylinder//Piston//Spring Assembly/Control Valve Flow/signed sqrt
- sldemo_hydcyl/Valve//Cylinder//Piston//Spring Assembly/Control Valve Flow/Product
- sldemo_hydcyl/Valve//Cylinder//Piston//Spring Assembly/laminar flow pressure drop
- sldemo_hydcyl/Valve//Cylinder//Piston//Spring Assembly/Sum7
- sldemo_hydcyl/Pump/IC
- sldemo_hydcyl/Valve//Cylinder//Piston//Spring Assembly/Control Valve Flow/Sum1 (algebraic variable)
- sldemo_hydcyl/Pump/Sum1
- sldemo_hydcyl/Pump/leakage (algebraic variable)

The laminar flow pressure drop block is contained in an algebraic loop with 8 other blocks.

Input Arguments

collapse all

Currently selected block, specified as gcb.

Example: ashow gcb

Block index in the model, specified as system index:block index.

Example: ashow 1:1

Data Types: double

Algebraic loop index, specified as system index#loop index

Example: ashow 0#1

Data Types: double

Remove algebraic loop highlighting from model.

Introduced before R2006a