Edit data cursor with several points

조회 수: 16 (최근 30일)
Hui Qiao
Hui Qiao 2018년 10월 29일
댓글: Hui Qiao 2018년 10월 29일
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);

답변 (1개)

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

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Calendar에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by