Hey everyone!

I created a priming experiment that works very well behaviourally, but for fMRI, I need to pseudo-randomize the order of presentation of the primes.

To do so, a program found the best combination of prime presentations for optimizing event-related potentials in the machine, such as I now have an excel sheet with one column that contains the best order to present the primes (i.e., first a happy prime, then sad, sad, then mas, then sad, then happy…).

So now, I have my initial excel sheet, comprising a column for prime stimuli, a column for target stimuli, and a last column with the type of prime (happy, sad, mask), and another excel sheet with the order of presentation.

**What I want to do:**

I need my code to take sequentially in the new excel sheet to get the order of prime presentation (i.e., happy prime first) and that the prime that it chooses is random between all the happy primes + the corresponding target (because it is the same face for prime and target). Then when it goes to the second line (i.e., sad) it takes randomly a sad trial (sad prime + corresponding target). When it falls on another happy prime, it has to be another of the happy primes but not one of the happy ones that have already been presented!

Thank you so much for your help!

Best,

Alexane