필터 지우기
필터 지우기

Datatip issue

조회 수: 5 (최근 30일)
Colm
Colm 2012년 2월 2일
I have an image and want to create a datatip. Then take its position. My problem is how do I 'wait' for the datatip to be create before using its position as a variable.
global X; %constant image, eg. imread('camera.tif');
datacursormode on;
i = cursor_info.Position;
k = i(1,1);
j = i(1,2);
a = X(k,:);
u = X(:,:);
So the issue is i = cursor_info.Position throws an error because it is trying to execute before it is created. How do i pause or hold the program until the datatip is export and named 'cursor_info'? or is there another method?
Thanks, Colm

채택된 답변

Sean de Wolski
Sean de Wolski 2012년 2월 2일
perhaps waitfor()?
Or a drawnow to force a flush of the graphics queue should work too.
  댓글 수: 2
Colm
Colm 2012년 2월 2일
Neither of those work.
I basically want the code to pause until a datatip is created.
Sean de Wolski
Sean de Wolski 2012년 2월 2일
And then get its position immediately? Its position immediately will not exist. If you want to wait until the user clicks then it sounds like you want to modify its updatefcn.
I = imread('cameraman.tif');
datacursormode on;
Hfig = figure;
Hax = axes;
imshow(I,'parent',Hax);
Hdcm = datacursormode(Hfig);
datacursormode on;
drawnow;
info = getCursorInfo(Hdcm);

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Graphics Performance에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by