Hello,
I’ve been trying to figure out how to select specific rows (rows 2 to 5 in iteration one, 6 to 9 in iteration two etc. in my case) and have only found this post to help: https://discourse.psychopy.org/t/selecting-different-rows-per-iteration-in-a-loop/.
It seems that the advice on that post no longer works with the current version of PsychoPy/some of the links have expired. Any advice is appreciated!
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.
The trials loop iterates over the rows specified in the Selected Rows parameter using the variable useRows.
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.
Best wishes Jens
2 Likes
This worked, thank you so much for your help!