Main Content

hasValue

Find if element instance has property value

    Description

    result = hasValue(instance,property) queries whether the instance instance has the given property property.

    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 query whether an instance element has a property included.

    openProject("scExampleSmallUAV");
    model = systemcomposer.loadModel("scExampleSmallUAVModel");
    instance = instantiate(model.Architecture,"UAVComponent","NewInstance");
    queryResult = hasValue(instance.Components(1).Components(1),...
    "UAVComponent.OnboardElement.Mass")
    queryResult = logical
       1
    
    

    Input Arguments

    collapse all

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

    Data Types: char | string

    Output Arguments

    collapse all

    Query result, returned as 1 (true) or 0 (false).

    Data Types: logical

    More About

    collapse all

    Version History

    Introduced in R2019a