The attributes table describes some ways that you can use data that you have attached to an entity.
Create a signal
Create a plot
Compute a different attribute value
Help specify behavior of a block that supports the use of attribute values for block parameters. Examples are the service time for a server and the selected port for an output switch.
Suppose that your entity possesses an attribute with one of these quantities:
Service time to be used by a downstream server block
Switching criterion to be used by a downstream switch block
When an entity with one of these attribute quantities arrives at a server or switch block, you can directly reference the attribute using an option on the server or switch block dialog box.
To manipulate attributes using code, use the Event
actions tab of a block. In this tab, you can write MATLAB® code
to manipulate the attribute. To access the attribute, use the notation
For example, you might want to manipulate the attributes for service completion.
In a new model, from the SimEvents® library, drag the Entity Generator, Entity Server, and Entity Terminator blocks and connect them.
Double-click Entity Generator and, in the Entity type tab, add three attributes to the attributes table.
In the Entity Server block, click the Event actions tab.
Service complete action,
enter MATLAB code to manipulate the entity attributes you added
in the Entity Generator block. For example:
This code updates the Entity Server block with the event action icon.
To see the action, in the model, hover over the Entity Server block event action icon block.