Why does the GINPUT function within MATLAB 7.0 (R14) return a wrong answer for the BUTTON output argument?
Ältere Kommentare anzeigen
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.
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Startup and Shutdown finden Sie in Hilfe-Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!