function test()
fig = figure;
a = [1 2 3 4 5];
b = [2 3 4 5 6];
c = [2 2 3 3 3];
name = {'one', 'two', 'three', 'four', 'five'};
DCM_Data.Position = [a; b; c];
DCM_Data.Title = name;
scatter3(a, b, c, 'filled')
dcm_obj = datacursormode(fig);
set(dcm_obj,'UpdateFcn', {@myupdatefcn, DCM_Data});
end
function txt = myupdatefcn(empt,event_obj, DCM_Data)
pos = get(event_obj,'Position');
[dummy, index] = min(((pos(1) - DCM_Data.Position(1, :)).^2) + ...
((pos(2) - DCM_Data.Position(2, :)).^2));
nameNumber = DCM_Data.Title{index};
txt = {nameNumber};
hold on
scatter3(pos(1), pos(2), pos(3), 'r', 'filled');
end