If mouse click in this rectangle, display rectangle in green
Show older comments
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!!
1 Comment
Jan
on 7 Mar 2013
This code is very weird.
Answers (3)
Doug Hull
on 25 Feb 2013
0 votes
You need to set callbacks on the rectangle.
This shows setting callbacks, the lessons should be similar.
Iris Müller Iris Müller
on 5 Mar 2013
0 votes
Iris Müller Iris Müller
on 7 Mar 2013
0 votes
1 Comment
Jan
on 7 Mar 2013
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.
Categories
Find more on App Building in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!