STROOP TEST- COGENT
이 질문을 팔로우합니다.
- 팔로우하는 게시물 피드에서 업데이트를 확인할 수 있습니다.
- 정보 수신 기본 설정에 따라 이메일을 받을 수 있습니다.
오류 발생
페이지가 변경되었기 때문에 동작을 완료할 수 없습니다. 업데이트된 상태를 보려면 페이지를 다시 불러오십시오.
이전 댓글 표시
0 개 추천
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 개 추천
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
- Color
- FaceColor
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
Tanitoluwa Femi-Idowu
2019년 12월 6일
Hi, I created the squares using the cgrect function
this is the code i used to get the word at the top of the screen with the 2 squares below it. the word was set by using cgtext and the squares using cgrect
config_display(0,1, [0 0 0], [1 1 1], 'calibri', 22,6);
start_cogent
cgloadlib;
warning('off','MATLAB:nargchk:deprecated')
cgscale(40)
cgpencol(1,0,0)
cgrect(-8,-4,7,7)
cgpencol(0,0,1)
cgrect(8,-4,7,7)
cgpencol(0,0,1)
cgfont('calibri',8)
cgtext('RED',0,10)
cgflip
wait(3000)
i want to know how i can randomise the word, the colour of the word and the colour of the squares
many thanks
Adam Danz
2019년 12월 6일
I don't have that library but I found the user manual and briefly looked up the function you're using.
These function appear to be wrapper functions to Matlab's text() and rectangle() functions. It wasn't clear in my 3-minutes of looking at the manual whether those functions have outputs that provide you with the object handle. If they do, you can use the same approach as in my answer.
Tanitoluwa Femi-Idowu
2019년 12월 6일
i used he manual to get these codes, i have also created a matrix containing a 9x2 structure.
the first column for the word of the colour and the 2nd to represent the colour of the word. I intend on duplicating the matrix multiple times and randomising the order. Im just stuck on how i can ensure the number representatives are linked to the actual code for the colour.
e.g. red is represented as - cgpencol(1,0,0)
and in my matrix red is represented as 1, blue as 2 and green as 3
so would i have to create aTable to distringuish the 2 rows from each other e.g. column(words) and column 2(colourofword)?
then
words(1 2 3)= [red;blue;green]
colourofwords(1 2 3)= [1 0 0;0 0 1;0 1 0]
so that the numbers in column 1 have a different representation to column 2
e.g. 1
column 1 is red
column 2 is [1 0 0]
Now your question is better defined but I'm still not 100% certain about what you want to do but I'll give it a shot (again).
See the inline comments for details.
% Create a 'key' table that defines the conditions.
K = table([1;2;3],{'red';'blue';'green'},[1 0 0; 0 0 1; 0 1 0],...
'VariableNames',{'index','colorWord','Color'});
% K =
% 3×3 table
% index colorWord Color
% _____ _________ ___________
% 1 'red' 1 0 0
% 2 'blue' 0 0 1
% 3 'green' 0 1 0
% Create n randomized colorWord / Color pairs
n = 10;
randIdx = randi(max(K.index),n,2); % randomized row selection
conditions = table(K.colorWord(randIdx(:,1)), K.Color(randIdx(:,2),:), ...
'VariableNames',{'colorWord','Color'});
% conditions =
% 10×2 table
% colorWord Color
% _________ ___________
% 'red' 1 0 0
% 'red' 0 0 1
% 'green' 0 0 1
% 'green' 0 1 0
% 'green' 1 0 0
% 'green' 0 0 1
% 'green' 0 0 1
% 'red' 0 0 1
% 'blue' 0 1 0
% 'blue' 0 0 1
To access condition number 4 (for example),
a = conditions.colorWord(4);
b = conditions.Color(4,:);
Tanitoluwa Femi-Idowu
2019년 12월 7일
Hi thanks for all the help,
I did
a = conditions.colorWord(1:45); to get the 45 WordColors
but when i did
b = conditions.Color(2:45); it didnt give me the 3 columns for color. instead it showed 1 line vertically instead of it being horizontal9 as it was shown in Conditions.
I tried doing
b = conditions.Color(1:45,2:45,3:45); but that didnt work, also tried with just (1:45). it only semi worked and showed the 2nd column for Color when i did b = conditions.Color(1:45,2:45,3); by accident. How do i get the whole of Color e.g.
1 0 0
0 0 1
0 0 1
0 1 0
1 0 0
0 0 1
0 0 1
0 0 1
0 1 0
0 0 1
to be in b using the b = conditions.Color(4,:); example.
Also, once the wordColour and Colour have been placed in A and B, will i be able to incorprorate them into a loop? so that the words in the stroop test are in a random order and with randomised colour font?
Adam Danz
2019년 12월 7일
Look at the example more closely.
b = conditions.Color(2:45,:);
Tanitoluwa Femi-Idowu
2019년 12월 7일
thanks for the help, its been fixed now i did b = conditions.Color(1:45,:); and all the 45 colour codes were put into b
I am also trying to create a loop for presenting the stroop words
- i know that A(word) and B(colour) now have a randomised order. i am now trying to incorproate that into a for loop.
How do i do this,
i went on the cogent website and this is the xample they gave for a stroop loop but i dont understand it, can you please help me explain what it means?
Adam Danz
2019년 12월 9일
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.
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Timing and presenting 2D and 3D stimuli에 대해 자세히 알아보기
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
