Attributes
In E-Prime, Attributes are like independent variables in experiment design. They are used to store and organize the levels of independent measures within the experiment, and are automatically logged to the data file when the experiment is run. In some ways, the term “attribute” is synonymous with the term “variable.” Both variables and attributes may be used to hold data associated with the measures used within an experiment (e.g., condition, stimulus, correct answer, response, etc.). However, attributes are related to the experiment Context (see SCRIPTING: Context [22875]). Data within the Context object is manipulated through the creation and setting of attributes. The table below is a brief comparison of Variables and Attributes.
Variables | Attributes |
Hold temporary values | Values saved to Context |
NOT logged in data file | Automatically logged in data file |
Created in script | Created in script or List object |
Accessible only within current scope/Procedure | Accessible within current or lower levels of Context |
Used only in script | Used in script or by E-Objects |
Initialized with 'Dim' statement (e.g., Dim Counter as Integer) | Initialized in a List object or in script (i.e., SetAttrib statement) |
Variables are distinguished from attributes in that they are not specifically related to the Context object. Variables are defined and accessible ONLY within a particular scope. That is, variables are temporary, and are discarded after the scope (e.g., Procedure) in which they are defined is exited (Note, variables declared in the User tab of the Script window are defined globally, so their scope spans the entire program). Once discarded, variables are no longer available within the experiment, and are not logged in the data file. Creation of variables occurs in script using the “Dim” statement.
In contrast, once entered into the Context (through creation on a List object or through the SetAttrib command in script), attributes are available at or below the level at which they are defined within the hierarchical structure of the Context (see SCRIPTING: Context [22875]). For example, an attribute created at the Block level of the experiment structure would be accessible also at the Trial and SubTrial level. In addition, upper level information may be inherited by lower level attributes (e.g., info held by attributes defined at the Block level may be inherited by Trial level attributes). Note, however, that upward inheritance is not possible. Thus, in order to reference or modify an attribute, it must be placed in the Context and set at the appropriate level (as determined by the needs of the experiment).
Perhaps most importantly, attributes and their values are automatically logged by E-Prime in the data file. Note that in order to control the number of columns/values logged to the data file, it is possible to disable, or turn off the logging of individual attributes.
Please watch the Advanced Attributes video for further information.
Next Article: SCRIPTING: Variable Declaration and Initialization [22878]
Previous Article: SCRIPTING: Object Methods [22877]
Comments
0 comments
Please sign in to leave a comment.