Main Content

findElement

Find element in interaction

Since R2024b

    Description

    element = findElement(interaction,UUID) uses the UUID to find elements in a sequence diagram that correspond to the interaction interaction.

    example

    Examples

    collapse all

    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 sequence diagram in the model, and then open the sequence diagram.

    interaction = model.addInteraction("NewSequenceDiagram");
    interaction.open

    Add a lifeline to the sequence diagram.

    lifeline = interaction.addLifeline(comp);

    Find a lifeline by name in the sequence diagram.

    lifelineFound = interaction.findLifeline(Name="Component")
    lifelineFound = 
    
      Lifeline with properties:
    
                   Name: 'Component'
               FullPath: 'archModel/Component'
                 Parent: [0×0 systemcomposer.interaction.Lifeline]
               Children: [0×0 systemcomposer.interaction.Lifeline]
        RelatedElements: [1×1 systemcomposer.arch.Component]
                   UUID: '6e96667a-c5a9-4480-90cc-808f6ebd46e4'
            ExternalUID: ''

    Find a lifeline by UUID in the sequence diagram.

    lifelineFoundByUUID = interaction.findElement(lifelineFound.UUID)
    lifelineFoundByUUID = 
    
      Lifeline with properties:
            externalUID: ''
                   name: 'Component'
        backendElements: [1×1 sequencediagram.lang.syntax.BackendElement Sequence]
                 parent: [1×0 sequencediagram.lang.syntax.Lifeline]
               children: [1×0 sequencediagram.lang.syntax.Lifeline Set]

    Input Arguments

    collapse all

    Interaction, specified as a systemcomposer.interaction.Interaction object.

    Universal unique identifier, specified as a character vector.

    Example: '91d5de2c-b14c-4c76-a5d6-5dd0037c52df'

    Data Types: char

    Output Arguments

    collapse all

    More About

    collapse all

    Version History

    Introduced in R2024b