Hi,
I'm trying to create an experiment with matlab and I am using 2 columns in a matrix with number I have randomized according to an index.
I cannot however have a repetition within one column and the two columns have to stay separated and keep the length of 36 elements.
so this is how I created my matrix:
for n = 1:6 l((n-1)*6+1:n*6,1)=n l((n-1)*6+1:n*6,2)=[1:6]endvec_index=randperm(36)vec_randomised=l(vec_index',:)
which gives me this:
5 3 4 2 4 1 4 6 5 5 6 3 1 5 1 2 1 6 6 5 3 2 6 1 5 4 1 4 2 3 3 5 5 2 2 2 6 2 4 3 2 6 3 6 5 1 2 5 6 4 2 1 6 6 3 4 3 3 4 4 5 6 1 1 2 4 3 1 1 3 4 5
as you can see there are repetitions for example the 3×4 in the first column.
I made a for-loop to detect the repetition but this does not help me to remove them and keeping the same numbers/amount of numbers in the column.
I also tried shuffle but this gives me different numbers.
I hope I need this as I want to couple this array to words and sounds (which I'm also failing at)
Hopefully someone can help! thx
Best Answer