how to write callback for check box
13 次查看(过去 30 天)
显示 更早的评论
hi how to write code to remove plot by unchecking check box.
function checkbox1_Callback(hObject, eventdata, handles)
% hObject handle to checkbox1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hint: get(hObject,'Value') returns toggle state of checkbox1
data=get(handles.uitable1,'data');
plot(data(:,1),data(:,2));
as per above callback i am able to plot when checkbox is checked, please guide me how to write code for unchecking checkbox so that plot gets deleted
0 个评论
采纳的回答
Walter Roberson
2013-2-4
if get(hObject, 'Value')
handles.plot = plot(data(:,1),data(:,2));
else
delete(handles.plot);
handles.plot = [];
end
guidata(hObject, handles);
0 个评论
更多回答(1 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!