Millisecond Forums

Adding columns to data file

https://forums.millisecond.com/Topic19610.aspx

By tela - 8/29/2016

I've tried to search the answer but have not have success so far. My understanding is that there is no way of adding custom data columns to the default data output automatically, but if I want my data to contain also columns I specify myself (e.g., values I calculate during the experiment from participant responses) in addition to defaults,  I need to define all the columns in the data element? (default columns + custom columns)

Does anyone have a template for that?



By Dave - 8/29/2016

> If I want my data to contain also columns I specify myself (e.g., values I calculate during the experiment from participant responses) in
> addition to defaults,  I need to define all the columns in the data element?

That is correct.

> Does anyone have a template for that?

No, because the default columns will be somewhat different for every script. Particularly the number of stimulusitem, etc. columns depends on how many stimuli your trial elements actually display (if the maximum number of stimuli any of your trials presents is 3, there will be 3 stimulusitem columns; if it is 5, there will be 5).

The default columns are detailed in https://www.millisecond.com/support/docs/v5/html/language/datarecording.htm and https://www.millisecond.com/support/docs/v5/html/language/attributes/columns.htm

You can also run through your script once using the default recording scheme and use the resulting data file as template for the default columns you should include.
By tela - 8/31/2016

Thanks, That was a good suggestion. However, when I am using the column labels generated by the default scheme (such as stimulusnumber4, stimulusitem4), I receive an error message "invalid expression 'stimulusnumber4' "...  Any idea how I should refer to these variables?
By Dave - 8/31/2016

You need to enter those in the /columns attribute *without* the numbers, as detailed at

https://www.millisecond.com/support/docs/v5/html/language/attributes/columns.htm

" [...] Stimulusnumber, stimulusitem, and stimulusonset receive special treatment.

The first stimulusnumber specified in the columns attribute indicates that the item number of the first stimulus appearing on the current trial should be recorded. The second stimulusnumber indicates that the item number of the second stimulus presented on the trial should be recorded, and so on. If no 1st, 2nd, 3rd, etc. stimulus is presented on a given trial, a '0' is recorded. [...].

Example
The following records 10 columns to the data file:
<data>

/ columns=(group, subject, computer.ipaddress.1, blockcode, trialcode, trialnum, latency, response, stimulusitem, stimulusitem, values.totalearnings, values.dprime, script.elapsedtime)
</data>

"

If you need to record 4 stimulusitem columns, you specify

/ columns = [..., stimulusitem, stimulusitem, stimulusitem, stimulusitem, ...]


(same applies to stimulusnumber and stimulusonset)

By tela - 8/31/2016

Oh, I see. Thanks for the clarification. I do have stimulus items 1-3 presented at each trial, but I am only interested in recording the fourth one since it varies. Anyway it does not hurt to record the extra ones, those columns can be easily removed afterwards.