0

I want to program an experiment that should consist of 10 trials (10 pictures) that a shown either on the left or right side. At the same time there is a odd or even number shown on the opposite side. I want to measure reaction time and response (odd or even). I guess I am stuck with the trial structure.

Is it enough to just define the ntrials = length(pictures) or do I need a for loop for the variables (pic_position, number_position)?

This is my approach so far:

   pic_pos = {'left' 'right'};
   num_pos = {'left' 'right'};
   evenodd = {'odd' 'even'};

   ntrials = length(pictures);

   for n = 1:length(pictures)
   trials(ntrials).picture = pictures(n)
   end

   pictures = Shuffle(pictures);

  for trial = 1:ntrials

  currentnumber = num2str(numbers{trial})

  switch trials(trial).num_pos
    case 'right'
    x = screencentrex + img_dist
    case 'left'
    x = screencentrex - img_dist
  end;

 Screen('TextSize', win, [25]);

 DrawFormattedText(win, currentnumber, [x], 'center', [255 255 255]);

 Screen('Flip', win);

 WaitSecs(3);

Unfortunately it doesn't show me the number.

Adriaan
  • 17,741
  • 7
  • 42
  • 75
Carina
  • 3
  • 2

1 Answers1

0

You don't neccessarily need to loop over the position or number variables. Instead, you can generate the stimulus parameters for each trial in advance, for example using the Psychtoolbox function BalanceFactors

[trialNumberPositions, trialNumberEvenOrOdd] = BalanceTrials(ntrials, 1, num_pos, evenodd);

This returns combinations of the levels of the factors 'num_pos' and 'evenodd', the orders of which are then randomized. So for example the number position for the trial number saved within the variable 'trial', in your example would be accessed as trialNumberPositions{trial}. Keep in mind that you have 4 unique combinations of evenodd and num_pos, so for your trial numbers to be balanced across conditions you would have a total number of trials that is a multiple of 4 (for example 12 trials total, rather than 10). I didn't include pic_pos because the pic_pos would always be whatever num_pos is not, as in your description the two stimuli would never be presented on the same side.

As to why your number isn't being displayed, it is hard to tell without more of the experiment script. But you are currently writing white text to the screen, is the background non-white?

DMR
  • 1,479
  • 1
  • 8
  • 11