Contenuto principale

validate

R2026b

Determine whether block path represents valid block hierarchy

Description

validate(bp) determines whether the block path represents a valid block hierarchy. If the block path is invalid, the function returns an error. The function checks that:

  • All elements in the block path represent valid blocks

  • Each element except the last is a valid Model block and references the model of the following element

example

Examples

collapse all

Suppose you have a Simulink.BlockPath object named bp that represents a Model block in a model hierarchy.

Check whether the block path specified by bp is valid.

validate(bp);

If the block path is invalid, the function returns an error. For example, the function returns an error when a model name or block name in the path has a typo.

For information on how to create a Simulink.BlockPath object, see Simulink.BlockPath.

Input Arguments

collapse all

Fully specified block path, specified as a Simulink.BlockPath object. This block path uniquely identifies a block within a model hierarchy, even when the model hierarchy references the same model multiple times.

Version History

Introduced in R2010b