This is probably a simple question, but I couldn’t find a solution.
I have two conditions files with different sets of images. And I have two routines - Trial and Que (see below). I have a code component within Trial which randomly selects one of the condition files. Right now it works. The issue is, I want Trial to present all images (rows) from the randomly selected conditions file and only after that should the Que begin with the same set of images.
What is the easiest solution to this? Thanks so much!
Do you want the second loop to be in the same order as the first. If so, then you could set a random seed in a Begin Experiment code component using seed = random() and then use it in both loops
It’s challenging to troubleshoot the issue without seeing all your settings, spreadsheets, etc. Any chance you can upload a zip file containing all of those?
My experiment is too large to share here unfortunately, but I added the second trial to your experiment (because I need two trials, that’s the whole issue with my experiment: it works perfectly with one trial, as does yours, but not with two trials) and it didn’t work either, although the error was different: * when preparing the trial list
unable to prepare trial list: unknown type: number
It seems to be working fine. See the following: Loops.zip (37.1 KB)
Can you replicate the error you’re getting in the experiment you sent? This time includes the spreadsheet so that I will have an identical experiment.
Also, try to compare your experiment to the one I sent.
Thanks a lot! I couldn’t find any differences between our experiments, yet I am constantly getting the * ReferenceError: asarray is not defined at the end of the first trial.
This is a link to the actual experiment, so there’s no way for me to see how you defined your spreadsheets or how you developed your experiment. I get the error you mentioned but I can’t troubleshoot it.
Maybe you can share the GitLab link (after changing it to public), so I will be able to see it as well?
I’m not sure why the asarray error even occurs since there is no code in these two loops. Anyway, I added the following code component in Before experiment tab:
let asarray=function(something) {
return something;
}
but the error persists
I guess it may be due to the scope of the variables as well as functions in JS language, that is, the functions you define possibly are local rather than global, so they cannot work in other places of your codes. I encountered similar issues before in my program, but when I re-defined the functions or objects when I used them, it worked out!