Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

Logging dynamic variables

Hi everyone,

I am currently struggling with creating a well-structured logfile for my experiment. Since I need to log a few variables per task, I created dynamic variables, "reaction_time" for instance:

var.set('reaction_time_{}'.format(n_tasks), reaction_time)

Checking the variable inspector after a test-run, everything seemed to have worked just fine, as in logging reaction_time_1, reaction_time_2, ..., etc., but importing the *.csv to Excel results in only one column named "reaction_time" and value "NA".

Is there anything I missed out here to make dynamic variables be written properly to the logfile?


  • Hi,

    If you call your variable "reaction_time_1" you have to look for this one in file. Opensesame writes a number of variables automatically, even if they are undefined. Can you find this variable in your list?


  • Hi Eduard,

    thanks for your reply. I do see them in the variable inspector in OpenSesame after an experimental run:

    However, they do not appear in the *.csv-logfile, unless I manually add custom variables to the logger item and call them "reaction_time_1", "reaction_time_2", "reaction_time_3" and so on. But then again, it wouldn't make any sense to create dynamic variables if I still have to manually add each one to be logged + I don't know how many will be needed as they differ from participant to participant.

    In my experiment, participants are given a reaction task every 7-10 seconds and I need to log the reaction time for each task. Depending on how much time participants take on the primary task, the number of reaction tasks (secondary tasks) will vary individually (as will the number of reaction times respectively).

    So basically, I am looking for a way to add a dynamic variable such as "reaction_time_{}.format(n_tasks)" to the logger item, instead of having to add one for each task not knowing how many tasks will be performed.

  • Hi Mr. Fugbaum,

    why don't you just log different variables using long format?

    For example:

    var.RT = yourresponsetime

    var.N_task = yourNofTheTask

    You can later switch this easily and automatically to wide format using tidyr package in R (does not work in Excel).

    Just an idea ;)


Sign In or Register to comment.