我正在使用 matlab gui 执行一些带有锁相环的信号处理,我似乎无法在我的代码中弄清楚数据被保存在哪里,即使我相信已经删除了它。
下面是设置功能。
function axes1_ButtonDownFcn(hObject, eventdata, handles)
% hObject handle to axes1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
position = get(gca,'CurrentPoint');
x = position(1);
y = position(3);
%handles.poles=handles.sVar;
%handles.zeros=handles.sVar;
%guidata(hObject,handles);
slType = get(handles.figure1 ,'SelectionType');
if(strcmp(slType,'normal'))
if(y<0.05 && y>-0.05)
line(x,y,'marker','X','HitTest','off');
handles.poles=handles.poles*(handles.sVar-x-y)
guidata(hObject, handles);
else
line(x,y,'marker','X','HitTest','off');
line(x,-y,'marker','X','HitTest','off');
handles.poles=handles.poles*(handles.sVar-x-y)*(handles.sVar-x+y);
guidata(hObject, handles);
end
else
line(x,y,'marker','O','HitTest','off');
handles.zeros=handles.zeros*((handles.sVar-x-y)*(handles.sVar-x+y));
guidata(hObject, handles);
end
update(hObject,handles);
set(hObject,'buttondownfcn',{@axes1_ButtonDownFcn,handles});
以下是删除数据的回调。
% --- Executes on button press in pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
guidata(hObject,handles);
delete(findobj(handles.axes1,'Type','line','Marker','X'));
handles.poles=handles.sVar;
guidata(hObject, handles);
update(hObject,handles);
% --- Executes on button press in pushbutton2.
function pushbutton2_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
guidata(hObject,handles);
delete(findobj(handles.axes1,'Type','line','Marker','O'));
handles.zeros=handles.sVar;
guidata(hObject, handles);
update(hObject,handles);