# Selecting a subset of total stimuli from excel without stimuli appearing multiple times

Dear all,
In my experiment I have an excel file containing 64 stimuli. For each participant I would like them to randomly see 10 out of the 64.
I have achieved this by reading other discourse conversations and using this on the Selected Rows column of my trials loop.

However, I have noticed sometimes some of the cues out of the 10 are the same as each other(not always).
Any advice on how to make sure the 10 randomly selected are different?
(Please note the 10 in nReps is because I would like my participant to then see those 10 stimulus repeatedly 10 times).

Sorry if this is obvious!

Best wishes,
Jess

Hi Jess,

The way you are selecting rows might well be random with replacement.

Personally I would select all rows (selected rows blank) and then end the loop after 10 iterations.

The. Add an outer loop with nReps 10.

``````if trials.thisN == 9:
trials.finished = true
``````

Hello,
When I have added the code you suggested to the “Begin Routine” portion, I do get 10 random stimuli appearing. But then the whole task ends, the second loop (trials_2) I have added with nReps 10 does not seem to work. How do I get it so I have only 10 random stimuli, but then they are shown 10 times?
Thanks in advance. Should it not go in Begin Routine?

Firstly, I can’t see your picture information, and secondly, you can achieve this function by defining the list。
List = [0,1,2,3,4,5,6,7,8]
This represents the stimulus of the first ten lines

Does it work locally? trials_2 with nReps = 10 should repeat the trials loop 10 times.

Please can you explain what you mean by this? Where should I define the list.

The photo showed that I had inserted the following code into the Begin Routine location:
if trials.thisN == 9:
trials.finished = True

This code successfully selects only 10 trials from the excel document which contains 64 trials.
My issue is that when the 10 trials are finished, I want the exact same 10 trials to be repeated 10 more times.

I have also tried: trials_2 with nReps = 10 however the same issue occurs of each 10 cycles involving 10 different cues each time.

Hope this is clear and thanks in advance:)

If you want to select 10 random rows for the first loop and then select the same rows next time then one option would be to append the current index to a list during the first loop and use that list as the selected rows for the second.

Have a look at my Repeat Subset demo PsychoPy Online Demos