Looping through different rows

OS (e.g. Win10):
Ubuntu 22.04 (but have acces to both windows 10 and 11 with pscyhopy running)

PsychoPy version (e.g. 1.84.x):
2.3

What are you trying to achieve?:

I have 400 stimuli (400 rows of an Excel file) I want to go through in an experiment built through builder Psychopy Builder.

To achieve that, I have a main loop (main_loop) and a nested loop (catego_block). The nested loop accesses the condition file (an excel file with 400 rows) whilst the main loop is the one keeping track of repetitions through the variable nReps. nReps is defined through Pyschopy GUI.

I would like to use the variable Selected rows defined through Psychopy Builder to choose which rows the loop catego_block accesses in the condition file.

That way, we can easily change the number of blocks : going from 20 blocks of 20 trials, to 40 blocks of 10 trials etc…

Thanks any help!

P.S. : There are many topics similar to this but they all seem like more complex use-case. It seems to me this particular use-case would be quite common and I imagine there is quite a simple solution to this :sweat_smile:, as it is quite a trivial problem.

Contrary to my reply in your other thread, this method would be very easy.

Start by setting up a list of the numbers 0 to 399 called allRows. Then set up useRows like this.

useRows = [ ]
for Idx in range(20):
     useRows.append(allRows.pop())

Then set $useRows as your selected rows for your inner loop.