If mouse click in this rectangle, display rectangle in green
3 次查看(过去 30 天)
显示 更早的评论
Hi!
I´m writing a psychological experiment (at least I try to), in which students shall click on a rectangle in my figure (on the screen). If they clicked on the correct rectangle the rectangle shall become green and it should be counted as a hit.
This was my code (which did not work):
if ('WindowButtonDownFcn', rectangle('Position', [0.7,0.4,0.1,0.1], 'facecolor', 'w'))
disp(rectangle('Position', [0.7,0.4,0.1,0.1], 'facecolor', 'g'))
Thanks for help!!
回答(3 个)
Doug Hull
2013-2-25
You need to set callbacks on the rectangle.
This shows setting callbacks, the lessons should be similar.
0 个评论
Iris Müller Iris Müller
2013-3-7
1 个评论
Jan
2013-3-7
The conventions in this forum are to accept an asnwer, if it has solved the problem. For a new question, a new thread is created. Posting the working solution is appreciated.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Image display and manipulation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!