Join free weekly webinars
Find us on

How to add a subject info into collected data

Data collection in EventIDE is done with a special integrated tool, called Report. Report is a high-speed and crash-protected storage for any data received during an experiment run. Adding new data to Report is a task that needs to be programmed in code snippets. For example, the following code adds a new line with 5 separated fields to the Report (usually such line is added on each trial)

Report="Current trial info;"+TotalTrialCount+";"+TrialCount+";"+CurrentBlock+";"+SubjectName+";"

After an experiment completed, all lines collected in Report can be exported to a text or Excel file.

In many scenarios it’s practical to add a subject info in the start of the data file. The subject info can contain several parameters, like participant’s name, age and other values defined individually for each participant. EventIDE does not have a startup window, where such parameters can be entered at the start of the experiment but, in fact, the similar task is easily achievable. Here, we show how to do it.

Composing the subject info

At the start, define a list of global variables in Header that will be used to store the subject info:

public string ParticipantName="Willem van Oranje";
public int ParticipantAge=478;
public string ParticipantPreferredHand="Right";

There are two ways to change values for each participant. First the values can be entered directly in the Header code:

public string ParticipantName="Mary";
public int ParticipantAge=21;
public string ParticipantPreferredHand="Left";


Secondly, if the public keyword is added before variable name (as on examples above), the global variable appears in the proxy list of the EventIDE designer:


Then, values of the global variable can be entered directly in the designer. The values will be preserved on an experiment run.

Storing the subject info

Suppose, these 3 variables compose the subject info that have to be stored beside of in the header of all collected data. The best way to accomplish it is to use the OnInitialized code snippets of the experiment object (it can be opened using the snippet panel, as below). The OnInitialized snippet is called once at the start of an experiment run, thus its the best place for all initialization actions.


Then, in the snippet code,  add the following code:

Report="ParticipantName: "+ParticipantName+"\n"+
        "ParticipantAge: "+ParticipantAge+"\n"+
        "ParticipantPreferredHand: "+ParticipantPreferredHand;


This code composes a string that contains three lines of the subject info (“\n” is a new line char) and add this string into Report. After exporting Report to a text file or to Excel, the header there would look  similar to this: 

ParticipantName: Mary

ParticipantAge: 21

ParticipantPreferredHand: Left

The OnInitialized snippet is also can be used to create a column headers for the data that is going to be saved later in an experiment. In this case, just add extra lines to the example above:

Report="ParticipantName: "+ParticipantName+"\n"+
        "ParticipantAge: "+ParticipantAge+"\n"+
        "ParticipantPreferredHand: "+ParticipantPreferredHand;
" Trial Index; Block Index; Condition Number; RT;"

Notice that you have to use “Report=Report+” expression if you want to compose several Report line in the same snippet. Only last value of any proxy variable (Report is a proxy variable) is actually counted when a snippet call ends, therefore the Report variable has to accumulate all additions.