title: How to get value from datacursor in GUI Matlab
body: <p>How can i get the value of cursor position from datacursor? here's my code</p>
  
  <pre><code>filename = handles.loadDataName;
  x=importdata(filename,' ',indexend);
  fid = fopen(filename,'r');
  A = textscan(fid,'%f%f','Delimiter',' ','headerLines',indexstart);
  data = cat(2,A{:});
  time = data(:,1);
  c1 = data(:,2);
  plot(handles.axes_grafik,time,c1)
  grid on;
  dcm = datacursormode(gcf);
  datacursormode on;
  set(dcm, 'updatefcn', @myfunction)
  
  
  function output_txt = myfunction( ~,event_obj)
  dataIndex = get(event_obj,'DataIndex');
  pos = get(event_obj,'Position');
  output_txt = {[ 'Time: ',num2str(pos(1),5)] .....,
      ['Amplitude: ',num2str(pos(2),5)]};
  </code></pre>
  
  <p>When i tried to modified <code>function output_txt</code> to get pos(1) and Pos(2) into global variable, i got an error on figure which says 'error in custom datatip string function' </p>
  
  <p>I want to retrieve pos(1) and Pos(2) to display it in editbox. Is there any way to do this? Thanks</p>