Edit data cursor with several points

16 vues (au cours des 30 derniers jours)
Hui Qiao
Hui Qiao le 29 Oct 2018
Commenté : Hui Qiao le 29 Oct 2018
Does anyone know how to edit the data cursor to fulfil the function in which we can click the mouse in several times and record the all 3D coordinates(such as click mouse three times, generate three group datas) into Excel file without enter "Alt"? I can only record one 3D coordinate right now, the code as follow:
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
xlswrite('1.xls',output_txt);

Réponses (1)

Steven Lord
Steven Lord le 29 Oct 2018
The data cursor doesn't seem to me to be the right tool for this job. I think you want ginput instead.
  1 commentaire
Hui Qiao
Hui Qiao le 29 Oct 2018
Thanks! I know ginput could be used in 2D pictures, but it doesn't seem to work well in 3D?

Connectez-vous pour commenter.

Catégories

En savoir plus sur Calendar dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by