selecting value using ginput

data = dlmread('value.txt');
plot3(data(:,1),data(:,2),data(:,3),'r.')
axis off
[x,y,z] = ginput(2)
ginput gives value in command window. I want that value above cursor on image when i select point. So, how to do..?

답변 (1개)

Walter Roberson
Walter Roberson 2013년 1월 3일

0 개 추천

댓글 수: 5

I seen the answer given by image Analyst.. i also tried it.. But, it worked for 2D image only..
I have 3D data. and it shows error..
??? Error using ==> impixelinfo at 83
The figure must contain at least one image.
Walter Roberson
Walter Roberson 2013년 1월 3일
Your question asks about "that value above cursor on image", but you do not have an image plotted according to the above code, so it is not clear what you want.
impixelinfo() is for use in determining data of images.
The solution I referred to over there used datacursormode() which does not require images to work.
Image Analyst
Image Analyst 2013년 1월 3일
Lalit, impixelinfo most certainly DOES work with color images. I know because I do it all the time. You case here is totally different. You actually don't have an image at all, like you did in your other question. Here you have a rendering of a plot of a few points in 3D - it's not a grayscale or color image in the sense that it's a solid 2D array of numbers. Do you understand the difference?
Lalit Patil
Lalit Patil 2013년 1월 4일
yes, datacursormode() works.. Now, i want to display that value in command window which i select on image..
Walter Roberson
Walter Roberson 2013년 1월 4일
Add an axes or lineseries ButtonDownFcn callback (if you add it to axes, be sure to set() 'Hittest', 'off' on all the lines in the axes)

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

카테고리

도움말 센터File Exchange에서 Data Exploration에 대해 자세히 알아보기

질문:

2013년 1월 3일

Community Treasure Hunt

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

Start Hunting!

Translated by