Select a random subgroup of rows

OS (Mac OS BigSur 11.6.1):
PsychoPy version (v2021.2.3):
**Standard Standalone? y
**What are you trying to achieve?: select a random subgroup of 5 rows from a condition file with 15 rows

Hi, I just went through a number of threads with similar inquiries but I couldn’t find an answer to my specific question. I have an Excel file with 15 rows that belong to 3 conditions. There are 5 stimuli in each of the 3 conditions. How should I set up the parameters so that for each participant, one condition is randomly selected, and the 5 stimuli for that condition are presented in a random order?

Thank you in advance,

Leila

Here’s one solution:

Begin Experiment

useRows =['0:5','5:10','10:15']
shuffle(useRows)

Then put $useRows[0] as the selected rows in the loop.

This presupposes that your three conditions are blocked in your spreadsheet and you have included a column for condition to confirm which condition each participant saw.

Hi, thank you so much - works perfectly!
Cheers!