문제

Using ginput (or ginputax) I ask my user to click on an axes 10 times (for spectrum baseline correction).

My axes is based on a GUIDE GUI.

Essentially this begins like this

plot(handles.axes_preview, ppm, xf_base, 'w-', 'LineWidth', 2);

spline_ppm = ginputax(handles.axes_preview, 10);

I'd like to plot each click (as ro) as they're being input, so the user has some feedback of where they clicked.

Any ideas how to code this?

도움이 되었습니까?

해결책

How about a simple loop?

axis(handles.axes_preview); %// make handles.axes_preview the current axis
hold on
for ii = 1:10
    coords(ii,:) = ginput(1);
    plot(coords(ii,1),coords(ii,2),'ro')
end

Also, you may want to add

set(handles.axes_preview),'XLimMode','manual');
set(handles.axes_preview),'YLimMode','manual');

at the beginning to prevent the axis scale from automatically changing as points are input by the user.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top