randomize trials but make sure they are equally shown

5 views (last 30 days)
Hi everyone,
I am writing Code for a metacognition Experiment. I would like to make sure that conditions are equally distributed within blocks of Trials (50% A, 50 B) but they are random at the same time. Shuffle just randomizes them and I have no idea how to do that. Thanks for your help.

Answers (1)

Walter Roberson
Walter Roberson on 19 Sep 2017
Within each block, use randperm to choose an order.
For example:
A = 1:20;
B = A+100;
AB = [A,B];
rAB = AB(randperm(length(AB))); %repeat as needed

Community Treasure Hunt

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

Start Hunting!