1.命令输入guide
2.建立GUI
3.添加控件
- Static Text 静态文本框
- Edit Text 编辑文本框
- Pushbutton 按钮
- Radiobutton 单选
- Axes 坐标轴
4.双击设置控件参数并保存
5.书写GUI回调函数(callback)代码
% --- 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)
close(gcf);
run('sigsample');
单选:
% --- Executes on button press in radiobutton1.
function radiobutton1_Callback(hObject, eventdata, handles)
% hObject handle to radiobutton1 (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 radiobutton1
set(handles.radiobutton1,'value',1);
set(handles.radiobutton2,'value',0)