Is there an easy way I can counterbalance a sequence with matlab?
2 views (last 30 days)
Show older comments
Here's the variables and conditions I'm working with.
TargetDir = [ 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2]'; % 1 = Right, 2 = Left FlankerDir = [ 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2]'; % 1 = Right, 2 = Left 0 = No flanker Sync = [1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3]'; % 1 = 100%, 2 = 70%, 3 = 30% RepeatNumb= 1; StimConds = repmat([TargetDir FlankerDir Sync], RepeatNumb, 1); RT = zeros(length(StimConds),1); %% Shuffle! % for i = 1:length(StimConds); temp = StimConds(i, :); shufflepos = ceil(rand*length(StimConds)); StimConds(i, :) = StimConds(shufflepos, :); StimConds(shufflepos, :) = temp; end So what I want to do is, while randomizing the sequence of conditions, I want to limit the number of consecutive sequences for the same condition in the TargetDir variable to maximum three.
For example,
1 1 2
1 1 1
1 1 2
2 2 1
1 1 1
1 1 2
2 2 2
2 2 3
2 2 1
2 2 3
2 2 2
1 1 3
1 1 1
1 1 3
2 2 2
2 2 3
1 1 3
2 2 1
This would be something I want to avoid since there are five consecutive 2 conditions for TargetDir variable. I want to limit the consecutive sequence for same conditions to maximum three.
How would I do this?
Thanks in advance!
0 Comments
Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!