This is a tricky one to explain so bare with me. I have four colors that randomize so no color is the same as any other color:
colarray = [c1; c2; c3; c4];colidx1 = randi(4,1,1);colour1 = colarray(colidx1,:);colidx2 = randi(4,1,1);while ismember(colidx2, colidx1)colidx2 = randi(4,1,1);endcolour2 = colarray(colidx2,:);colidx3 = randi(4,1,1);while ismember(colidx3, [colidx1, colidx2]) colidx3 = randi(4,1,1);endcolour3 = colarray(colidx3,:);colidx4 = randi(4,1,1);while ismember(colidx4, [colidx1, colidx2, colidx3]) colidx4 = randi (4,1,1);endcolour4 = colarray(colidx4,:);
and I have four arrows that randomize so that no arrow is facing the same direction as any other arrow:
random = randperm(4)random1 = random(1)random2 = random(2)random3 = random(3)random4 = random(4)if random1 == 1tri1 = downtri b1 = vertbaseq1elseif random1 == 2tri1 = uptri b1 = vertbaseq1elseif random1 == 3tri1 = righttri b1 = horzbaseq1elsetri1 = lefttri b1 = horzbaseq1endif random2 == 1 tri3 = downtri b3 = vertbaseq3elseif random2 == 2tri3 = uptri b3 = vertbaseq3elseif random2 == 3tri3 = righttri b3 = horzbaseq3elsetri3 = lefttri b3 = horzbaseq3endif random3 == 1 tri4 = downtri b4 = vertbaseq4elseif random3 == 2tri4 = uptri b4 = vertbaseq4elseif random3 == 3tri4 = righttri b4 = horzbaseq4elsetri4 = lefttri b4 = horzbaseq4endif random4 == 1 tri2 = downtri b2 = vertbaseq2elseif random4 == 2tri2 = uptri b2 = vertbaseq2elseif random4 == 3tri2 = righttri b2 = horzbaseq2elsetri2 = lefttri b2 = horzbaseq2end
Each arrow will correspond to the arrow keys on the keyboard and the color will appear in an oval behind the arrow. I have a target color (c1). I want some way of saying if the arrow is the target color, then there will be a different response than if the person selects an arrow that isn't the target color. I'm not too worried about the keypresses (I think I can figure that out), but I'm not sure how to associated arrow direction with the target color.
Any help will be greatly appreciated, Brett
Best Answer