Incorrect results for button output of ginput returned when double clicking
조회 수: 3 (최근 30일)
이전 댓글 표시
MathWorks Support Team
2017년 12월 13일
편집: MathWorks Support Team
2025년 11월 10일
When clicking the center or right mouse buttons multiple times very quickly, the second and third results for the 'button' output is incorrectly given as 1 (left mouse click).
Running the following code and click the right button rapidly on the axes.
[x,y,button] = ginput(3)
The 'button' output has many 1's registered. Why does this happen?
채택된 답변
MathWorks Support Team
2025년 11월 10일
편집: MathWorks Support Team
2025년 11월 10일
This is the expected behavior. Based on the documentation, the 3rd return argument from this function can be a "vector of integers indicating which mouse buttons you pressed (1 for left, 2 for middle, 3 for right)".
When double-clicking quickly using the middle button the Figure's SelectionType property becomes "Open" based on the
. This can be verified by the following:
f = gcf;
f.SelectionType %should return 'normal'
[x,y,button] = ginput(3) %click right button rapidly on axes
f.SelectionType %should now be 'open'
This is considered to be a "Left click" in ginput. When clicks are made rapidly several times, ginput will register all those clicks and since all clicks after the first are "Open", they all translate to button "1" or left click.
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Data Exploration에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!