Main Content

Simulink.allBlockDiagrams

Find loaded Simulink models and libraries

Description

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

example

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 the get_param function 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 whose 'Dirty' parameter is set to 'on' in the current Simulink session.

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.

Version History

Introduced in R2018a