Main Content

getProperty

Get property value corresponding to stereotype applied to element

Description

[propertyValue,propertyUnits] = getProperty(element,propertyName) obtains the value and units of the property specified in the propertyName argument. Get the property corresponding to an applied stereotype by qualified name "<profile>.<stereotype>.<property>".

example

Examples

collapse all

Get the weight property from a component with sysComponent stereotype applied.

Create a model with a component called Component.

model = systemcomposer.createModel("archModel");
systemcomposer.openModel("archModel");
arch = get(model,"Architecture");
comp = addComponent(arch,"Component");

Create a profile with a stereotype with a property, then apply the profile to the model.

profile = systemcomposer.profile.Profile.createProfile("sysProfile");
base = profile.addStereotype("sysComponent");
base.addProperty("weight",Type="double",DefaultValue="10",Units="g");
model.applyProfile("sysProfile");

Apply the stereotype to the component, and set a new weight property.

applyStereotype(comp,"sysProfile.sysComponent")
setProperty(comp,"sysProfile.sysComponent.weight","5","g")

Get the weight property with units.

[val,units] = getProperty(comp,"sysProfile.sysComponent.weight")
val =

    '5'

units =

    'g'

Input Arguments

collapse all

Name of property, specified as a character vector or string in the form "<profile>.<stereotype>.<property>".

Data Types: char | string

Output Arguments

collapse all

Value of property, returned as a character vector.

Data Types: char

Units of property to interpret property values, returned as a character vector.

Data Types: char

More About

collapse all

Version History

Introduced in R2019a