Welcome!

Sign in with your CogSci, Facebook, Google, or Twitter account.

Or register to create a new account.

We'll use your information only for signing in to this forum.

Supported by

Add condition assignment from excel document

I am wanting to assign participants to view one of 2 video stimuli based on a pre-existing group assignment. I have an excel document with participant ID (1 to 200) in column A and assignment (0 or 1) in column B. How can I get the 'assignment' variable to be recognised by OpenSesame so that in the Experiment Sequence I can add 'run if' instructions (e.g. [assignment]=1)?

Comments

  • RoelofRoelof Posts: 102

    Hi Kayling,

    You could put all the assignment values in a list that can be read by python and then extract from the list on the basis of the subject number so first in excel you might want to make a comma separated list that you can copy to python:

    Then you can copy the translated line to an inline script in opensesame and you can obtain the values from the list using the subject number:

    assignment_list = [1,1,0,1,'etc'] * 900
    var.assignment = assignment_list[var.subject_nr]

    print var.assignment
    print var.subject_nr
    if var.assignment == 1:
    print 'something'

    Now you should also be able to use the variable assignment in the "run if" part of a loop and/or sequence, like in the following small example script. Its a good idea to double check the subject number and assignment values by printing them as well.

Sign In or Register to comment.