Main Content

setValue

Set value of property for element instance

Description

example

setValue(instance,property,value) sets the property of the instance to value.

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

Examples

collapse all

Load the Small UAV model, create an architecture instance, and set the mass property value of a nested component. Get the new value to confirm the change.

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

    2


unit =

    'kg'

Input Arguments

collapse all

Property, specified as a character vector in the form '<profile>.<stereotype>.<property>'.

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

More About

collapse all

Definitions

TermDefinitionApplicationMore Information
analysisAnalysis is a method for quantitatively evaluating an architecture for certain characteristics. Static analysis analyzes the structure of the system. Static analysis uses an analysis function and parametric values of properties captured in the system model.Use analysis to calculate overall reliability, mass roll-up, performance, or thermal characteristics of a system, or to perform a SWaP analysis.Analyze Architecture
instanceAn instance is an occurrence of an architecture model at a given point of time.You can update an instance with changes to a model, but the instance will not update with changes in active variants or model references. You can use an instance, saved in an .MAT file, of a System Composer™ architecture model for analysis.Create a Model Instance for Analysis

TermDefinitionApplicationMore Information
stereotypeA stereotype is a custom extension of the modeling language. Stereotypes provide a mechanism to extend the architecture language elements by adding domain-specific metadata.Apply stereotypes to the root level architecture, component architecture, connectors, ports, and interfaces of a model. Stereotypes provide model elements within the architecture a common set of property fields, such as mass, cost, and power.Define Profiles and Stereotypes
profileA profile is a package of stereotypes to create a self-consistent domain of model element types.Apply profiles to a model through the Profile Editor. You can store stereotypes for a project in one profile or in several. Profiles are stored in .xml files when they are saved.Use Stereotypes and Profiles
propertyA property is a field in a stereotype. For each model element the stereotype is applied to, specific property values are specified.Use properties to store quantitative characteristics, such as weight or speed, that are associated with a model element. Properties can also be descriptive or represent a status.Set Properties

Introduced in R2019a