datatipp.m 522 B

123456789101112131415
  1. %% PART OF GUI FUNCTIONALITY %%
  2. % Display the position of the data cursor
  3. function output_txt = datatipp(~,event_obj)
  4. % obj Currently not used (empty)
  5. % event_obj Handle to event object
  6. % output_txt Data cursor text string (string or cell array of strings).
  7. pos=get(event_obj,'Position');
  8. output_txt={['X: ',num2str(pos(1),4)],['Y: ',num2str(pos(2),4)]};
  9. % If there is a Z-coordinate in the position, display it as well
  10. if length(pos) > 2
  11. output_txt{end+1}=['Z: ',num2str(pos(3),4)];
  12. end
  13. end