What are you trying to achieve?:
Dear Psychopy Community:
I am trying to load a randomly selected number of stimuli (words) from a conditions file.
My current issue is that the words that are retrieved from the file repeat sometimes. However, they should appear no more than once.
What did you try to make it work?:
I am currently using the builder and have inserted a loop that calls up the excel file. In the loop properties, under ‘selected rows’ I have entered $random(6)*40. This works well for repeating the loop 6 times, however, every once in a while a word repeats.
What can I do to make sure that each word comes up only once?
Thank you in advance!
If I understand correctly, you are trying to pick 6 words (out of 40) for each of the 6 repeats.
Instead of having nReps as 6 and selecting 6 rows each time you could select all rows and end the loop after 36 trials. If you want something to happen every 6 trials then use if trials.thisN%6 == 0: for 0, 6, 12 or if trials.thisN%6 == 5: for 5, 11, 17.
Many thanks for your response! So the routine is quite short and only one word is presented per repeat. So ‘nReps’ is set to 1 and loop Type is set to random. With the ‘selected rows’ set to $random(6)*40, six words are shown in total (as desired), however, sometimes a word repeats, which it is not supposed to.
Your suggestion looks interesting, however I’m not sure if I understand. Where would I need to insert this code?
Thanks!