how get value at pos(3) position by using "datacursormode on" in axes ???

조회 수: 3 (최근 30일)
This is my coding :
%%----->DO 2D CONTOUR MAP<-----%%
B = get(handles.uitable2,'Data');
[C,h] = contourf(B); %countour map the excel in 2D with handles
set(h,'LineWidth',2) %handles line width with "2"
im builde the GUIDE in MATLAB....
The question is, how can i retrieve value at pos(3) position by using "datacursormode on" to display at editbox??? can u continue my command please... URGENT...
  댓글 수: 1
Geoff Hayes
Geoff Hayes 2017년 3월 3일
muhammad - please don't post your question in multiple threads, especially as an answer to another question.

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

채택된 답변

Walter Roberson
Walter Roberson 2017년 3월 3일

추가 답변 (1개)

Geoff Hayes
Geoff Hayes 2017년 3월 3일
handles.dcm_obj = datacursormode(hObject);
set(handles.dcm_obj,'Enable','on','UpdateFcn',{@myupdatefcn,hObject});
In the myupdatefcn callback, you will need to define the text string (similar to the output you have shown in the image). As this uses pos, then you have access to the third element which you can set back in the edit text field of your GUI since we are assuming that the hObject passed into this callback (when set above) is the handle to the figure.
function txt = myupdatefcn(~,event_obj,hFigure)
pos = get(event_obj,'Position');
txt = 'something using pos';
handles = guidata(hFigure);
if isfield(handles,'text1')
set(handles.text1,'String',num2str(pos(3)));
end
The above assumes that text1 is the control to update with your text.
  댓글 수: 6
muhammad zulhelmy
muhammad zulhelmy 2017년 3월 5일
i want to get VALUE datacursormode POSITION 3 at axes and display it at edit6.
HOW I WANT TO DO THAT if using an AXES?
and
HOW I WANT TO DO THAT if using figure?
muhammad zulhelmy
muhammad zulhelmy 2017년 3월 5일
from figure, also tells that "error datatip custom string function"

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

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by