Main Content

Simulink.allBlockDiagrams

Find loaded Simulink models and libraries

Description

example

bd = Simulink.allBlockDiagrams() returns all loaded block diagrams, including models and libraries.

bd = Simulink.allBlockDiagrams(type) returns either models or libraries.

Examples

collapse all

Find all loaded models in the current Simulink® session, excluding libraries. The example shows a result from a typical session.

Simulink.allBlockDiagrams('model')
ans =

  237.0001
   56.0001
    2.0001

Find all loaded models in the current Simulink session and return results as names. Use Simulink.allBlockDiagrams with get_param to get the names. The example shows a result from a typical session and includes loaded libraries and models.

get_param(Simulink.allBlockDiagrams(),'Name')
ans =

  5×1 cell array

    {'simulink_extras'}
    {'simulink'       }
    {'sldemo_fuelsys' }
    {'f14'            }
    {'vdp'            }

Find all loaded models in the current Simulink session whose 'Dirty' parameter is 'on'.

bds = Simulink.allBlockDiagrams();
dirtyBds = bds(strcmp(get_param(bds,'Dirty'),'on'));

Input Arguments

collapse all

Type of block diagram whose blocks to return, specified as 'model' or 'library'.

Output Arguments

collapse all

Loaded block diagrams, returned as an array of handles.

Introduced in R2018a