| SimEvents® | ![]() |
Attributes
This block accepts an entity, assigns data to it, and then outputs it. Assigned data is stored in attributes of the entity, where each attribute has a name and a value. See Attribute Value Support to learn what kind of data an attribute can store.
Note If you attach large arrays to entities in a model that contains a server or a queue block with large capacity, the simulation could run out of memory. |
Each attribute corresponds to a row in the table on the Set Attribute tab in the block's dialog box. Buttons to the left of the table let you manipulate rows in the table:
To add a new row to the table, click the Add button
.
To duplicate a row, select it and click the Copy button
.
To remove a row, select it and click the Delete button
.
Note The dialog box does not ask you to confirm the deletion and does not offer an undo operation. However, if you delete a row by mistake, you can click Cancel to ignore unapplied changes. |
Note Deleting a row and applying the change might affect signal input ports corresponding to other rows of the table. For example, if the block has a signal input port A2 and you delete the row marked A1, then the block renames A2 as A1. Check that any signal that connects to the renamed port is still connected as you expect. |
Within each row, you can specify properties of the attribute that corresponds to that row.
Assigning a Constant Value Using the Block Parameters Dialog Box
Select the Name field and type the name of the attribute you want to set. All names that would be valid variable names in the MATLAB® language, except nan and inf (with any use of case), are valid as attribute names. To determine whether a name is a valid variable name, use the isvarname function.
Set Value From to Dialog.
Select the Value field and enter the value for the attribute.
Determine if the constant value you typed is a vector that you want the block to interpret a one-dimensional array rather than a multidimensional array. If yes, select Treat Vector as 1-D.
Assigning a Value Using an Input Signal
Select the Name field and type the name of attribute you want to set. All names that would be valid variable names in the MATLAB language, except nan and inf (with any use of case), are valid as attribute names. To determine whether a name is a valid variable name, use the isvarname function.
Set Value From to Signal port. The Value and Treat Vector as 1-D fields become disabled.
Click OK or Apply. The block now has a signal input port whose label matches the label to the left of the row of the table (A1, A2, etc.).
Connect a signal to the Ax input port. During the simulation, the block assigns the value of this signal to the attribute. The signal must be sample-based instead of frame-based.
Entity Input Ports
| Label | Description |
|---|---|
| IN | Port for arriving entities. |
Signal Input Ports
| Label | Description |
|---|---|
| Ax | Data to assign for the attribute specified in the Ax row of the table in the dialog box. This port appears only if you set Value From in the Ax row to Signal port. |
Entity Output Ports
| Label | Description |
|---|---|
| OUT | Port for departing entities, with data assigned to them. |
Signal Output Ports
| Label | Description | Time of Update When Statistic Is On |
|---|---|---|
| #d | Number of entities that have departed from this block since the start of the simulation. | After entity departure |
The initial output value, which is in effect from the start of the simulation until the first update by the block, is 0.

The name of the attribute to set.
Determines whether the data for attribute values comes from the dialog or a signal.
The value to assign to the attribute. This field is active only if you set Value From to Dialog.
This option affects attributes whose Value From parameter is set to Dialog and whose Value parameter evaluates to an N-element row or column vector. Selecting this option causes the block to assign the attribute as a vector of length N. Otherwise, the block assigns the attribute as a multidimensional array.
Selecting this option enables the block to define new attributes. Otherwise, the block issues an error if any attribute named in the table does not already exist.
These parameters determine whether certain ports produce data throughout the simulation, produce data only when you stop or pause the simulation, or are omitted from the block. For descriptions of the affected ports, see the "Signal Output Ports" table above.

Controls the presence and behavior of the signal output port labeled #d.
Setting Attributes of Entities
![]() | Schedule Timeout | Set Attribute (Obsolete) | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |