Hauptinhalt

getObjectTypes

R2026b

Get class name of each element in collection

Since R2026b

    Description

    types = getObjectTypes(coll) returns the fully qualified class name of each element in coll, in collection order. getObjectTypes(coll) returns the same value as the Types property of coll.

    example

    Examples

    collapse all

    List the types in a collection to find out which types you can filter by.

    Get all elements from the workspace and their class names. The result has one entry for each element.

    allElements = myFullWorkspace.getElements;
    types = getObjectTypes(allElements);
    size(types)
    ans =
    
         1    13

    List the distinct types. You can pass any of these names to filterByType.

    unique(types)'
    ans =
    
      8×1 string array
    
        "sysml.FeatureMembership"
        "sysml.FeatureTyping"
        "sysml.Namespace"
        "sysml.OwningMembership"
        "sysml.Package"
        "sysml.PartDefinition"
        "sysml.PartUsage"
        "sysml.Subclassification"

    Input Arguments

    collapse all

    Collection, specified as a sysml.Collection object.

    Output Arguments

    collapse all

    Class names of the elements, returned as a string array the same size as coll. Each entry is a fully qualified class name, such as "sysml.PartDefinition". For an empty collection, types is a 1-by-0 string array.

    Data Types: string

    More About

    collapse all

    Version History

    Introduced in R2026b