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
回答 (1 件)
dpb
2016 年 1 月 20 日
0 投票
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.
1 件のコメント
Walter Roberson
2016 年 1 月 20 日
The Question http://uk.mathworks.com/matlabcentral/answers/262638-default_getdatatiptext-m-matlab-r2014 suggests that in R2014a and earlier, default_getDatatipText.m is the function that is called upon by default.
カテゴリ
ヘルプ センター および File Exchange で Characters and Strings についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!