Multiple Randomized Images from the Same Excel File


I am trying to run an experiment where I show two images on the screen at the same time from the same Excel stimulus file. When I tried to randomize the images by looping, what shows up is the same image twice. I was wondering how to fix this so that the images are different.
For some reason, the two images on the screen come up the same when instead I am supposed to get two different, random images presented on the screen.


1 Like

Hi @leorelizur, are the stimuli paired in sets or are pairs generated randomily?

They are paired in sets

right, then you will want two columns in your conditions file, where each column corresponds to one of your two stim and contains the paths for each stimulus. Then, for each image stim, you reference each column as a variable e.g., $column1 and $column2… The loop will handle the randomisation.

1 Like

perfect, thank you!

Sorry for being so sudden. But if i want the two images be random, how can i do that? @dvbridges thank you.

You mean changing Loop Type to Random ?
If not, you can put as many as image addresses you want in the 2 columns of your Excel file.
Also you can create a List full of image addresses and by a random index (number) retrieve 2 image addresses and put their addresses in image component source.

I would recommend the youtube channel of Dr. Jason Ozubko for these problems.


The videos are really useful. Thanks. But I got another problem now which I cannot add the images into the excel file. The psychopy said it cannot find the image file but I have put the script and the images file in the same folder and double check with the name. Is there anything else that I could have done wrong? Thank you so much for your reply.

Hi @Angel_Tam,

Seeing from your statement it is unclear where the error is occuring. Could you post the type of error so that it would be more clear what the exact problem is? Also the excel file (itself or screenshot) for clearer view of the problem?


excuse me, would you please explain a little more?
I have the same problem. I have a trial which shows 4 different image but when I use a loop to randomize images and show different replacement of them at 4 corners of screen the trial shows four same images and when I build for columns in Excel the problem remain unsolved, since I think I need a randomizing function which localize every image at different positions on the screen but I don’t have such function or code.can you help me, please? Also I have another question whether for counter balancing the task I must show the all 24 permutation of images or randomizing the images show is enough?