Hello,
I am creating an experiment in which participants are asked to write associations to cue words (in the first iteration) and then write associations to their own associative responses to cue words from the first iteration (next iteration). What is the best way to realise it?
In the first section add the responses to a list:
e.g. if the cue is Cue and the participants respond in a textbox called textbox
Begin Experiment
responses = []
End Routine
responses.append([Cue,textbox.text])
Then in Begin Routine in the gap
nPairs = len(responses)
Then have a second loop with no spreadsheet and number of repititions nPairs. If that second loop is called trials_2 then present the participant with responses[trials_2.thisN][1]
Donât forget to save the data:
thisExp.addData('Cue', responses[trials_2.thisN][0])
thisExp.addData('FirstAssociation', responses[trials_2.thisN][1])
Thank you very much! Could you pls explain this in a more detailed manner for beginners?
Have you done this bit yet? If not then I would focus on this (a loop presenting cues and an editable textbox response) first.
Iâm working on it now. Unfortunately, I have some difficulties with it because I hardly use code when creating experiments)
You shouldnât need any code for the first bit.
Hello,
Based on your recommendations, I modeled the task as follows:
The file «tasks.xlsx» contains a list of cue-words. The code component in «seeds» contains the code you provided for «Begin Experiment» and «End Routine». The code component in «routine_2» contains the code you provided for «Begin Routine». Something is going wrong. Where is my mistake?
Put one loop around each routine, not around both?
You currently have 3 cue words assigned to a variable called condition?
I recommend that you try to get the cue aspect working before switching your focus to the second routine.
- Done;
- Yes, but in a real experiment there will be more of them;
- The first routine actually works fine. The question is why the second routine does not present the participantsâ responses obtained in the first routine?
Cool. In that case have you tried adding the code components I suggested? Please show any code components plus the loop and text component in the second section.
Sure, here are: 1) the code component and loop properties in the first routine; 2) the code component, loop properies and text component in the second routine.
The first code component looks correct.
The second needs to go in a routine in between the two loops.
Num repeats for trials_2 should be mPairs
test_2 should display the text
$responses[trials_2.thisN][1]
Now it works! Thank you very much for your help!
Could I ask you for one more piece of advice?
Is it possible to have participants give multiple word-responses to a given cue-word (e.g. separated by commas) and then display each of these word-responses in next iteration? How difficult is it to implement?
I think you could do this simply by editing the End Routine code to.
words = textbox.text.split(',')
for word in words:
responses.append([condition,textbox.text])
Here the result. How Ńan i solve it?
Maybe it should be words = textbox.text.split(",")
You could add print('words',words)
on the following line to check the split has worked.
No results, unfortunately. Maybe there is another way?
Please be more specific. Please could you paste the output of the print statement?
Hello,
the output is as follows:
words ['yellow', ' fruit'] words ['red', ' juice'] words ['tree', ' fruit']
Thank you for your help in advance, I really appreciate it.
That looks okay. Now print(responses)