Output value of entity attribute
This block outputs signals using data from entity attributes. For each arriving entity, the block updates the signal at the signal output ports using values from attributes named in the block dialog box. The block also outputs the entity unchanged.
Use the Available Attributes controls to:
Select the attributes from incoming entity paths that you want to access.
Add the attributes to the Get Attribute table, where you can modify them.
The list displays all the attributes on all the incoming entities. (If the entity paths entering the Get Attribute block do not have any attributes, the Available Attributes list is empty).
If the attribute list is long, you can type the attribute name in the text box to filter the list.
Use the buttons in the Available Attributes section to help build the attributes table. The buttons perform these actions:
Refresh the Available Attributes list. This action updates the list with any upstream model changes you make while the block dialog box is open.
Add the selected attribute to the Get Attribute table.
Move the selected attribute from the Get Attribute table to the Available Attributes list.
Note: If the selected attribute is one you added manually, this button appears dimmed.
The message area below the available attributes list displays additional messages about the attributes, as they apply.
> Attribute already selected
You have already added the attribute to the Get Attribute table. You cannot add the attribute to the table again.
* Attribute may not be present
When multiple entity paths enter the block, all entities might not have the same attributes. Attributes that are not on all entering entities display an asterisk in the list, and this message appears. If you add such an attribute to the Get Attribute table, the behavior depends on how the If Missing field is set.
Use the controls under Get Attribute to build and manage the list of attributes to access on each incoming entity. Each attribute appears as a row in a table.
Using these controls, you can:
Specify an attribute manually to access on the entity.
Modify an attribute that you added to the table from the Available Attributes list to access on the entity.
The buttons under Get Attribute perform these actions:
Add a template attribute to the table.
Rename the attribute and specify its properties.
Add a copy of the selected attribute to the table to use as the basis of a new attribute.
Rename the copy. Two attributes cannot have the same name.
Remove the selected attribute from the Get Attribute table.
When you delete an attribute this way, no confirmation appears and you cannot undo the operation.
Note: If you delete a row and apply the change, the deletion can affect signal output ports corresponding to other attributes. For example, if the block has a signal output port A2 and you delete the attribute with a port marked A1, the block relabels A2 as A1. Verify that any signal that connects to the relabeled port is still connected as you expect.
The table displays the attributes you added from the Available Attributes list or added manually. Use it to set these four attribute properties:
The name of the attribute to access. Each attribute must have a unique name.
If the attribute name does not match an attribute listed in Available Attributes, the block displays ?? next to the attribute name. This symbol denotes that the attribute is not present on incoming entity paths. The simulation behavior you see depends on the value of If Missing (see Missing Attributes).
Double-click the existing name, and then type the new name.
The response of the block when the entity does not have an attribute named in the table.
Select a block response from the list.
The value for the corresponding output signal if the entity does not have an attribute specified in the table. To learn about the kind of data you can use as a default value, see Attribute Value Support. You can set this field only if you set If Missing to Default value or Warn.
Double-click the field and type a value.
|Vector Is 1-D|
Whether the block considers the default value as a vector of length N when Default Value evaluates to an N-element row or column vector. Otherwise, the block considers the default value as a multidimensional array. This option affects attributes whose If Missing parameter is set to Default value or Warn.
Select the check box to treat the attribute as a vector of length N. Clear it to treat the attribute as a multidimensional array.
You can specify the block behavior if the arriving entity does not have an attribute listed in the table of the block dialog box. Use the If Missing parameter for that attribute.
|Parameter Value||Block Behavior in Case of Missing Attribute|
|Error||The block issues an error message and halts simulation. In this case, the Default Value and Treat Vector as 1-D parameters are disabled.|
|Default value||The block outputs a default value that you specify using the Default Value and Treat Vector as 1-D parameters. The simulation proceeds.|
|Warn||The block outputs a default value that you specify using the Default Value and Treat Vector as 1-D parameters. The block also issues a warning in the MATLAB® Command Window. The simulation proceeds.|
These parameters determine whether the block produces data at signal output ports or omits those ports. For descriptions of the data and ports, see Signal Output Ports.
Entity Input Ports
|IN||Port for arriving entities|
Entity Output Ports
|OUT||Port for departing entities|
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|
|Attribute name||Value of the attribute of the same name specified in the table. The default Name that corresponds to each row is Attributex, where x = 1, 2, 3, etc.||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 for all signals.