Main Content

convertToCell

Convert block path to cell array of character vectors

Description

example

cellarray = convertToCell(bp) converts a block path to a cell array of character vectors.

Examples

collapse all

Open the project named ModelReferenceHierarchy.

openProject("ModelReferenceHierarchy");

The project opens a model hierarchy with sldemo_mdlref_depgraph as the top model.

Create a Simulink.BlockPath object.

bp = Simulink.BlockPath(...
    {'sldemo_mdlref_depgraph/thermostat',...
    'sldemo_mdlref_heater/Fahrenheit to Celsius',...
    'sldemo_mdlref_F2C/Gain1'});

Create a cell array that represents the elements of the block path.

cellarray = convertToCell(bp)
cellarray = 3x1 cell
    {'sldemo_mdlref_depgraph/thermostat'         }
    {'sldemo_mdlref_heater/Fahrenheit to Celsius'}
    {'sldemo_mdlref_F2C/Gain1'                   }

Input Arguments

collapse all

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

Output Arguments

collapse all

Block path elements, returned as a cell array of character vectors.

Version History

Introduced in R2010b

See Also

Objects

Functions