Why does the GINPUT function within MATLAB 7.0 (R14) return a wrong answer for the BUTTON output argument?
显示 更早的评论
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.
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Startup and Shutdown 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!