程序:
1、界面初始化
% --- Executes just before GEARstress is made visible.
function GEARstress_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to GEARstress (see VARARGIN)
movegui('center') %使界面居中
set(handles.text65,'string','欢迎使用直齿圆柱齿轮应力计算界面','fontsize',...
16,'fontweight','bold'); %采用静态文本的办法,给界面添加一个标题,并设置其字体的大小与粗体
字
% Choose default command line output for GEARstress
handles.output = hObject;
% Update handles structure
guidata(hObject, handles); %数据更新
% UIWAIT makes GEARstress wait for user response (see UIRESUME)
% uiwait(handles.figure1);
2、下拉式菜单(只给出一例)
% --- Executes on selection change in popupmenu1.
function popupmenu1_Callback(hObject, eventdata, handles)
% hObject handle to popupmenu1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)