Main Content

getValue

Get value of property from element instance

Description

[value,unit] = getValue(instance,property) obtains the property property of the instance instance and assigns it to the specified value value.

Note

This function is part of the instance programmatic interfaces that you can use to analyze the model iteratively, element-by-element. The instance refers to the element instance on which the iteration is being performed.

example

Examples

collapse all

Load the small unmanned aerial vehicle (UAV) model, create an architecture instance, and get the mass property value of a nested component.

openProject("scExampleSmallUAV");
model = systemcomposer.loadModel("scExampleSmallUAVModel");
instance = instantiate(model.Architecture,"UAVComponent","NewInstance");
[massValue,unit] = getValue(instance.Components(1).Components(1),...
"UAVComponent.OnboardElement.Mass")
massValue = 
1.7000
unit = 
'kg'

Input Arguments

collapse all

Property, specified in the form "<profile>.<stereotype>.<property>".

Data Types: char | string

Output Arguments

collapse all

Property value, returned as a data type that depends on how the property is defined in the profile.

Property unit, returned as a character vector that describes the unit of the property as defined in the profile.

Example: 'kg'

Data Types: char

More About

collapse all

Version History

Introduced in R2019a