Why does the GINPUT function within MATLAB 7.0 (R14) return a wrong answer for the BUTTON output argument?
Show older comments
To reproduce this behavior, execute the following function.
function mytest
line
flag = true;
while flag
[zx, zy, button] = ginput(1);
button
if (button==3) %right button is clicked -> stop
flag = false;
end
end
close
First, click the left mouse button.
You will see that a "1" is correctly returned indicating a left button click.
Then, click the right mouse button. You will see that a "3" is correctly returned indicating a right button click, and the code will close the figure.
Then, execute the function again, and click the left mouse button. You will see that a "2" is incorrectly returned.
Accepted Answer
More Answers (0)
Categories
Find more on Startup and Shutdown in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!