how to increase the number of digits for the coordinates of a point in figure when I click one.

I am trying to read precisely the value of a point from a graph. In a specific case, the x values of all points are the same up to first four digits and vary after the fifth digits. For example, they all look like 12.34xxx. When I click one point in the graph, the Matlab shows the first four digits which is not useful for me. Is there anyway that I can change the default setup so that I will always be able to see more than four digits of numbers in a graph?
I see the text update function as shown below. I can see I can change the number of digits in this script, but then my changing it doesn't mean that I will always use a new text-update function for all others.
function output_txt = myfunction(obj,event_obj)
% Display the position of the data cursor
% obj Currently not used (empty)
% event_obj Handle to event object
% output_txt Data cursor text string (string or cell array of strings).
pos = get(event_obj,'Position');
output_txt = {['X: ',num2str(pos(1),4)],...
['Y: ',num2str(pos(2),4)]};
% If there is a Z-coordinate in the position, display it as well
if length(pos) > 2
output_txt{end+1} = ['Z: ',num2str(pos(3),4)];
end

Answers (1)

I don't see a place to set the default callback; it probably does exist somewhere but didn't find it documented in the time I had available to search.
You can, however, use datacursormode to create a data cursor object and subsequently modify the callback function it uses for a given figure during the code that creates the figure.

Categories

Asked:

on 20 Jan 2016

Commented:

on 20 Jan 2016

Community Treasure Hunt

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

Start Hunting!