Products & Services Solutions Academia Support User Community Company

Learn more about Simulink   

find_mdlrefs - Find Model blocks and referenced models at all levels or at top level only

Syntax

[refMdls, mdlBlks] = find_mdlrefs(modelName)
[refMdls, mdlBlks] = find_mdlrefs(modelName, allLevels)
[refMdls, mdlBlks] = find_mdlrefs(modelName, 'Param1', Val1, ... ,'ParamN', ValN)

Description

[refMdls, mdlBlks] = find_mdlrefs(modelName) finds all Model blocks and referenced models contained by the model hierarchy of which modelName is the top model.

[refMdls, mdlBlks] = find_mdlrefs(modelName, allLevels) is equivalent to the preceding syntax if allLevels is true. If allLevels is false, the function searches only the top level of modelName, ignoring any subordinate hierarchy.

[refMdls, mdlBlks] = find_mdlrefs(modelName, 'Param1', Val1, ... ,'ParamN', ValN) searches the model as specified by the optional name/value pairs 'Param1', Val1, ... , 'ParamN', ValN.

Inputs

modelName

The model to be searched for Model blocks and referenced models.

allLevels

Boolean specifying whether to search the complete hierarchy (true) or only the top model modelName (false). Default: false.

'Param1', Val1, ... , 'ParamN', ValN

One or more name/value pairs that control the function's actions. The possible names and values, and their defaults, are:

'AllLevels'Boolean specifying whether to search the complete hierarchy (true) or only the top level (false). The default if you omit 'AllLevels' is true: the function searches the complete hierarchy of which modelName is the top model.
'IncludeProtectedModels'Boolean that specifies whether the output refMdls includes the names of protected models (true) or excludes them(false). The default if you omit 'IncludeProtectedModels' is false: the function excludes protected models from refMdls.
'Variants'

String that specifies whether the output refMdls includes the names of variant models. The possible values are:

  • 'ActiveVariants' — Include the active variant of each variant Model block included in the search.

  • 'ActivePlusCodeVariants' — Include all variants for all variant Model blocks included in the search whose Generate preprocessor conditionals option is selected.

  • 'Allvariants' — Include all variants for all variant Model blocks included in the search.

The default if you omit 'Variants' is 'ActivePlusCodeVariants'.

Note that find_mdlrefs provides two different ways to search all levels of the model modelName. Both techniques give the same results, but only the name/value technique allows you to control inclusion of protected and variant models in refMdls.

Outputs

mdlBlks

A list containing the names of all Model blocks in the hierarchy of which modelName is the top model, or in modelName alone, depending on the value of 'AllLevels'.

refMdls

A list containing the names of all models referenced by Model block in the hierarchy of which modelName is the top model, or in modelName alone, depending on the value of 'AllLevels'. Optional inputs to find_mdlrefs control inclusion of protected and variant models. The last element of the refMdls is modelName itself.

Example

Return in MyMdlBlks the names all Model blocks at the top level of MyModel. Return in MyRefMdls the names of all models referenced by Model blocks at the top level, including the active variant of every variant Model block:

[MyRefMdls, MyMdlBlks] = find_mdlrefs(MyModel, 'AllLevels', false, 'Variants', 'ActiveVariants')

See Also

Model | view_mdlrefs

How To

  


Related Products & Applications

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS