ginput turning off cursor R2016a

조회 수: 1 (최근 30일)
Michael Vaiana
Michael Vaiana 2017년 3월 1일
편집: Tom Dresselaers 2017년 9월 21일
I am writing a GUI with guide and when I call ginput it turns off my mouse cursor. I know this is an old issue that was apparently resolved but I am still experiencing the problem in MATLAB 2016a.
I am calling ginput after a ButtonDownFcn as follows:
% load an image into the axis and set buttondownfnc
function load_image_Callback(hOBject, eventdata, handles)
...
set(handles.img, 'ButtonDownFcn', {@my_button_press, handles})
...
end
%call ginput upon buttdown
function my_button_press(src, ~, handles)
[x,y] = ginput(1);
...
end
When I click the image my cursor disappears, if I click again I get the x,y corrdinates of the point I click, so ginput is working, but I can't see where I'm clicking. Any ideas?
  댓글 수: 2
Sonam Gupta
Sonam Gupta 2017년 3월 8일
Tom Dresselaers
Tom Dresselaers 2017년 9월 21일
편집: Tom Dresselaers 2017년 9월 21일
I tried it in R2016a but did not work. Other options?
my workaround create your own myginput with modification (store in your working dir): set(gcf,'Pointer','crosshair','PointerShapeCData',cdata,'PointerShapeHotSpot',hotspot) % original version: set(gcf,'Pointer','custom','PointerShapeCData',cdata,'PointerShapeHotSpot',hotspot)

댓글을 달려면 로그인하십시오.

답변 (1개)

Sam McDonald
Sam McDonald 2017년 3월 8일
The cursor does disappear, but you should be able to see the crosshairs that appear once you move the mouse. If those are not being displayed, you could try the following
1. Execute:
opengl software
That will switch to a software version of OpenGL. If that resolves the issue, make sure your graphics driver is up-to-date. Visit the manufacturer's website for the latest driver rather than trusting the operating system.
2. Change the figure renderer. 'opengl' is default, but there is also 'painters'.
  댓글 수: 1
Michael Vaiana
Michael Vaiana 2017년 4월 9일
I'm so sorry for the extremely late reply. I tried suggestions 1 3 does give me the cursor but it is not very fluid. For example, sometimes I click and nothing seems to happen and then I click again and all of the sudden I have 2 points.
1, unfortunately, didn't help at all. I'm working on 2 but I can't seem to figure out how to get the figure handle for the axes to change the renderer to painters.
I also made a discovery. I am calling ginput after a ButtonDwnFnc call so I can restrict it to a certain axes. When I use ginput without such a ButtonDwnFnc the crosshairs show up. The problem is they show up on the whole image and not the specified axis. So it seems to be a problem with calling ginput from a ButtonDwnFnc call.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by