| Reference | Downloads | Github

Randomization of several loops

OS : Win 10
PsychoPy version : v20201.3
**Standard Standalone? : y
What are you trying to achieve?:
My experiment does have 4 different loops until now. My goal is that those 4 different loops repeat themselves 3 times in a randomized order.

What did you try to make it work?:
I tried to create an randomized outer loop around the 4 inner loops and as well I tried to set up a conditions file for this outer loops. Both ideas did not work for me.

What specifically went wrong when you tried that?:
There is no error message. The experiment runs smoothly. But the randomization is missing.

Include pasted full error message if possible. “That didn’t work” is not enough information.

Are you trying to randomise the order of Start 1-4?

What you need is for them all to be dealt with using a single routine with parameters from the outer loop

Thank you for your reply!

Yes that is what I am trying to do as the routines differ slightly from each other.

If I understand it right I should create one single routine and specify the different parameters of every trial in the outer loop?

Again thank you for your help!

If the routines truly are different (ie they differ in ways that can’t be controlled just by using a conditions file (such as one routine playing a sound, while another shows an image), then you could control the order of the loops like this:


Nice but you don’t even need code.

The outer loop could connect to and Excel file with columns called e.g. Task1 Task2 with each row having a 1 in one column and a 0 in all the others.

For each task the nReps for the loop around it should be the corresponding column name.


Thanks a lot! Now it works.