Edit data cursor with several points

17 visualizzazioni (ultimi 30 giorni)
Hui Qiao
Hui Qiao il 29 Ott 2018
Commentato: Hui Qiao il 29 Ott 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);

Risposte (1)

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

Accedi per commentare.

Community Treasure Hunt

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

Start Hunting!

Translated by