How to randomize visual presentation trials when each trial contains multiple, separately presented images.

1 次查看(过去 30 天)
I have very little experience with MatLab. I am trying to develop a visual perception experiment using MatLab.
In this experiment, subjects will first be presented with an object consisting of three simple shapes. Then, they will be shown a second image, which is either identical or different. These images will be .jpg images, created outside of MatLab.
The subject's task is to press a key (s) if the objects are the same and a different key (d) if the objects are different. The results I am collecting will be error rates and reaction times. I have figured out how to present visual stimuli and get a response using MatLab.
My problem is that, for this experiment, each trial consists of one image (image1) followed by the presentation of another image (image2). I need the trials to be randomized but within each trial, I need to present the two images in a specific order: image1, then image2. I will have 320 separate trials, each consisting of two images. How do I get MatLab to randomize the individual trials without randomizing the presentation of the images within a single trial?
I realize you won't be able to tell me the entire coding necessary to do this, but maybe give me the code for an experiment that uses a similar paradigm or even tell me the name of a book that specifically tells me how to do this. Thanks in advance.

回答(1 个)

Doug Hull
Doug Hull 2012-7-23
for i = 1: nTrials
imshow(image_i)
if rand<0.5 (randomly choose A)
imshow(image_iGood)
else
imshow(image_iBad)
end
end
The above will get you to choose between two options for the second image.
  1 个评论
Larissa
Larissa 2012-7-25
Doug, thanks for the response. I'm sure that your code is what I'm looking for but I'm trying to figure out how to get started with this experiment. This will be my first full MatLab script, so I have very little experience. I'm wondering if I will need to create an individual loop for every single trial (I need 160 trials for this experiment) or if there's a way to make one loop that can do all the trials. Do you have any experience using PsychToolbox?

请先登录,再进行评论。

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by