Selecting different rows per iteration in a loop - updated advice?

Hello,

this might do the trick. See the flow of a toy-experiment:

The Text-component simply displays a number (stim) read from the Excel file SelectedRows.xlsx".

Numbers range from 0 to 9.

grafik

The trials loop iterates over the rows specified in the Selected Rows parameter using the variable useRows.

grafik

I set the loopType to sequential just for testing. useRows is set in the code-component codeRow of the routine setRow. Add the following code to the Begin routine tab of the code-component

if block.thisRepN == 0:
    useRows = '2:5'
elif block.thisRepN == 1:
    useRows = '6:9'

You may want to initialise useRows in the Begin Experiment tab.

useRows = '0:2'

Set the loopType of the block-loop to sequential and the number of repetitions to 2.

grafik

Best wishes Jens

2 Likes