Shuffle rows after routines

Hi there,

I have 4 conditions in my excel sheet with 104 questions (4 columns and 104 rows). Each round (loop) participants will need to rate 5 questions from each 4 conditions, which means they will need to complete 20 questions each loop/round. I want each routine to display questions from different rows (for example, first questions displays from row 2 in the shame_condition, then the second question will the row 4 (any rows would work as long as not the row 2) in devaluation_condition, and so on. However, I found that psychopy will first select the row, then read the columns afterwards, which caused me to have a hard time accomplishing the way I wanted. Could anyone help me out? i will appreciate that a lot!!! Please!!! Thank you!

This is how my excel sheet looks like:

This is the how my loop info and routines look like:

Any help will be greatly appreciated! Thanks again!

I think you want to have independent randomisation of your rows (using the loop randomisation) and the chosen column.

You could look at my independent randomisation demo, but the principle would be to have a shuffled array containing 1 to 4 5 times and then some code to select the column based on the value popped from that array.

Begin Experiment

conditions = [1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4]
shuffle(conditions)

Begin Routine

condition = conditions.pop()
if condition == 1:
     thisText = shame_condition
     thisExp.addData('Condition','shame')
elif  condition == 2:
     ....

Thank you so much! It worked so perfectly!!! I also have another question, what should I do if I have one condition to appears five times but with different questions (display 5 different questions from a shame_condition, then display 5 questions from other conditions)?

Begin Experiment

conditions = [1,2,3,4]
condition = 0
shuffle(conditions)

Begin Routine (within a loop called trials)

if trials%5 == 0:
     condition = conditions.pop()
if condition == 1:
     thisText = shame_condition
     thisExp.addData('Condition','shame')
elif  condition == 2:
     ....

the code seems promising, but an error occurs saying "trials not identified’, should there be another name for that? Thank you so much!

What is your loop called?

Sorry also it should be trials.thisN

oh my god, it worked! Thank you so much wakecarter! It took me so long to try figuring that out. Finally! Thanks again!