Select different rows per loop

What are you trying to achieve?:
I am very new to coding. In my experiment, I’m testing memory and there are a study phase, a retention phase and a test phase. There are a total of 3 trials which means all the phases will repeat 3 times. I have 3 sets of 20 math problems (a total of 60 questions, under the file “FillerQ.csv”) created for the retention phase. I want to display each set in random order per trial and receive feedback on each individual answer.

What did you try to make it work?:


I created a loop for the retention task. Within the loop, there is a routine with codes, the math task itself, and a feedback routine. In the code, I put LoopNum = 0; under begin experiment and LoopNum +=1; under begin routine. In the loop, I put $((LoopNum-1)*20):(LoopNum*20) under the selected rows. Running the experiment led to an error as below:

########### Running: /Users/teammaster/Desktop/Experiment_lastrun.py ###########
18422.3347 INFO Loaded monitor calibration from [‘2020_10_01 16:51’]
File “/Users/teammaster/Desktop/Experiment_lastrun.py”, line 603
trialList=data.importConditions(‘FillerQ.csv’, selection=((LoopNum-1)20):(LoopNum20)),
^
SyntaxError: invalid syntax
################ Experiment ended with exit code 1 [pid:34882] #################

I tried (for the selected rows):

  • not putting $ in front
  • using eval(‘’)
    But nothing worked.

Try

$str((LoopNum-1)*20)+':'+str(LoopNum*20)

Personally I would put something like

useRows = str((LoopNum-1)*20)+':'+str(LoopNum*20)

in a code component and then put $useRows in the loop

1 Like