主要内容

systemcomposer.activity.Tag

R2026b

Tag in activity diagram

Since R2026b

    Description

    A Tag object represents a tag in an activity diagram. A tag is used by send action nodes and accept action nodes to send and receive tokens.

    Creation

    Create a tag in an activity diagram using the addTag function.

    tag = addTag(activity,'structChannel');

    Properties

    expand all

    Name of the tag, specified as a character vector.

    Example: 'structChannel'

    Data Types: char

    Data type of tokens transferred between paired send and accept action nodes.

    Object Functions

    destroyRemove model element

    Examples

    collapse all

    Create an activity diagram model and get the root activity.

    adModel = systemcomposer.createActivity("sendAcceptModel");
    activity = get(adModel,"Activity");

    Add an initial node, action nodes, and an activity final node.

    initialNode = addNode(activity,"Start","initial");
    action1 = addNode(activity,"Process Data","action");
    action2 = addNode(activity,"Handle Signal","action");
    finalNode = addNode(activity,"End","activityfinal");

    Define a tag in the activity.

    tag = addTag(activity,"A");

    Add a send action node and assign the tag name. A send action node sends object tokens to accept action nodes with the same tag name.

    sendNode = addNode(activity,"Send Data","sendaction");
    sendNode.TagName = "A"
    sendNode =
    
      SendAction with properties:
    
                    TagName: 'A'
                     Parent: [1×1 systemcomposer.activity.Activity]
                       Pins: [1×1 systemcomposer.activity.Pin]
                       Name: 'Send Data'
                   Position: [200 250 300 290]
                      Model: [1×1 systemcomposer.activity.Model]
             SimulinkHandle: 217.0001
        SimulinkModelHandle: 165.0022
                       UUID: 'e3120c5d-62ad-4243-bade-06ff481ae81e'
                ExternalUID: ''

    Add an accept action node with the same tag name. The accept action node receives object tokens from send action nodes that share the same tag name.

    acceptNode = addNode(activity,"Receive Data","acceptaction");
    acceptNode.TagName = "A"
    acceptNode =
    
      AcceptAction with properties:
    
                    TagName: 'A'
                     Parent: [1×1 systemcomposer.activity.Activity]
                       Pins: [1×1 systemcomposer.activity.Pin]
                       Name: 'Receive Data'
                   Position: [200 250 300 290]
                      Model: [1×1 systemcomposer.activity.Model]
             SimulinkHandle: 221.0001
        SimulinkModelHandle: 165.0022
                       UUID: '279b5f42-6697-4097-9fb9-89fed0dbecc7'
                ExternalUID: ''

    Connect nodes to create the activity flow. The send and accept action nodes communicate using a shared tag name.

    connect(initialNode,action1);
    connect(action1,sendNode);
    connect(acceptNode,action2);
    connect(action2,finalNode);

    More About

    expand all

    Version History

    Introduced in R2026b