【发布时间】:2014-08-04 21:48:14
【问题描述】:
我有一个 Gui,它有一个轴...在轴上我可以用 plot 画线..但我想选择轴的线..我尝试使用 buttondownfcn..但它没有t 工作.. 我有一个按钮 DELETE,它的回调是:
hold all;
set(handles.axes6, 'HitTest', 'off');
set(handles.axes6,'ButtonDownFcn',('h = copyobj(gcbo,figure)'));
delete_object_axes = findobj(h, 'Type', 'line');
我的代码是:
% --- Executes on mouse press over axes background.
function axes6_ButtonDownFcn(~, ~, handles)
% hObject handle to axes6 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
hold all;
set(handles.axes6, 'HitTest', 'off');
set(handles.axes6, 'ButtonDownFcn', {@Delete_Callback, handles}');
% --- Executes on mouse press over figure background, over a disabled or
% --- inactive control, or over an axes background.
function figure1_WindowButtonDownFcn(~, ~, handles)
% hObject handle to figure1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
hold all;enter code here
global h;
set(handles.axes6, 'HitTest', 'off');
h = findobj(handles.axes6, 'Type', 'line');
set(h, 'ButtonDownFcn', {@Delete_Callback});
帮帮我..如何选择和删除一行???或移动???有什么办法吗??? 这对我来说很重要..拜托!!帮帮我!:)
【问题讨论】:
-
我是否理解正确 - 您希望能够在单击时从轴中选择一条线,并在单击“删除”按钮时将其删除?
标签: matlab matplotlib