- Color
- FaceColor
STROOP TEST- COGENT
8 views (last 30 days)
Show older comments
Tanitoluwa Femi-Idowu
on 6 Dec 2019
Commented: Adam Danz
on 9 Dec 2019
Hi,
a) how do create a stroop test to randomise the colour of the word. e.g. the word 'RED' with a blue/green/white font colour
b) i am also interested in randomising the colour of a square
i have the codes to display the word and the 2 squares below it but how do i get it to run with varying colours throughout the experiment in a randomised order?
any help would be much appreciated and many thanks in advance
0 Comments
Accepted Answer
Adam Danz
on 6 Dec 2019
Edited: Adam Danz
on 6 Dec 2019
The handle to the text object and the handle to the "square" (not sure what you mean here, it could be a rectangle object, a patch object, an axes, who knows...) both have properties that allow you to edit their colors. But the property names vary between different sets of objects. Since we don't know what kind of objects you're working with, we can only be as specific as the content offered in your question (which isn't specific).
The two most common property names that changes an object's color are
This demo below shows you how to change the "Color" property. The "FaceColor" property of other objects works in the same way.
h = text(. . .);
h.Color = 'r';
% -or-
h.Color = [1 0 0];
% -or-
set(h, 'Color', [1 0 0])
9 Comments
Adam Danz
on 9 Dec 2019
Here's a general template to show how to set up a loop. I don't know what loop you want to make but you can follow this plan:
for i = 1:size(conditions ,1)
% access the i_th condition
condition.colorWord(i)
condition.Color(i)
end
About the content on the cogent website, there are comments on each line of the code that tells you what the lines are doing. If you have a question about a specific line and cannot understand the help() and doc() literature, tell me which line to help you out with.
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!