版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、杨杰_控制工程_1382030120_计算机仿真作业(3)1. GUI设计:设计界面接收学生信息(姓名,年龄,性别,爱好),分别使用适当的控件,输入后单击显示按钮输出信息。function varargout = zuoye1(varargin)% ZUOYE1 M-file for zuoye1.fig% ZUOYE1, by itself, creates a new ZUOYE1 or raises the existing% singleton*.% H = ZUOYE1 returns the handle to a new ZUOYE1 or the handle to% the
2、existing singleton*.% ZUOYE1('CALLBACK',hObject,eventData,handles,.) calls the local% function named CALLBACK in ZUOYE1.M with the given input arguments.% ZUOYE1('Property','Value',.) creates a new ZUOYE1 or raises the% existing singleton*. Starting from the left, property va
3、lue pairs are% applied to the GUI before zuoye1_OpeningFunction gets called. An% unrecognized property name or invalid value makes property application% stop. All inputs are passed to zuoye1_OpeningFcn via varargin.% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one% insta
4、nce to run (singleton)".% See also: GUIDE, GUIDATA, GUIHANDLES% Copyright 2002-2003 The MathWorks, Inc.% Edit the above text to modify the response to help zuoye1% Last Modified by GUIDE v2.5 20-Apr-2014 21:00:51% Begin initialization code - DO NOT EDITgui_Singleton = 1;gui_State = struct('
5、gui_Name', mfilename, . 'gui_Singleton', gui_Singleton, . 'gui_OpeningFcn', zuoye1_OpeningFcn, . 'gui_OutputFcn', zuoye1_OutputFcn, . 'gui_LayoutFcn', , . 'gui_Callback', );if nargin && ischar(varargin1) gui_State.gui_Callback = str2func(varargin1)
6、;endif nargout varargout1:nargout = gui_mainfcn(gui_State, varargin:);else gui_mainfcn(gui_State, varargin:);end% End initialization code - DO NOT EDIT% - Executes just before zuoye1 is made visible.function zuoye1_OpeningFcn(hObject, eventdata, handles, varargin)% This function has no output args,
7、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 zuoye1 (see VARARGIN)% Choose default command line output for zuoye1handles.output = hObject;% Up
8、date handles structureguidata(hObject, handles);% UIWAIT makes zuoye1 wait for user response (see UIRESUME)% uiwait(handles.figure1);% - Outputs from this function are returned to the command line.function varargout = zuoye1_OutputFcn(hObject, eventdata, handles) % varargout cell array for returning
9、 output args (see VARARGOUT);% hObject handle to figure% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% Get default command line output from handles structurevarargout1 = handles.output;% - Executes on button press in pus
10、hbutton1.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)name=get(handles.edit1,'string');age=get(handles.edit2,
11、39;string');sex=get(handles.edit3,'string');hobby=get(handles.edit4,'string');str2=name age sex hobby;set(handles.edit5,'string',str2);guidata(hObject,handles);function edit1_Callback(hObject, eventdata, handles)% hObject handle to edit1 (see GCBO)% eventdata reserved - t
12、o be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% Hints: get(hObject,'String') returns contents of edit1 as text% str2double(get(hObject,'String') returns contents of edit1 as a doubleget(hObject,'string');% - Executes dur
13、ing object creation, after setting all properties.function edit1_CreateFcn(hObject, eventdata, handles)% hObject handle to edit1 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called% Hint: edit controls us
14、ually have a white background on Windows.% See ISPC and COMPUTER.if ispc set(hObject,'BackgroundColor','white');else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor');endfunction edit2_Callback(hObject, eventdata, handles)% hObject handle to edit2
15、 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% Hints: get(hObject,'String') returns contents of edit2 as text% str2double(get(hObject,'String') returns contents of edit2 as a doubleget(hObject
16、,'string');% - Executes during object creation, after setting all properties.function edit2_CreateFcn(hObject, eventdata, handles)% hObject handle to edit2 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all Create
17、Fcns called% Hint: edit controls usually have a white background on Windows.% See ISPC and COMPUTER.if ispc set(hObject,'BackgroundColor','white');else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor');endfunction edit3_Callback(hObject, eventdata
18、, handles)% hObject handle to edit3 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% Hints: get(hObject,'String') returns contents of edit3 as text% str2double(get(hObject,'String') returns conte
19、nts of edit3 as a doubleget(hObject,'string');% - Executes during object creation, after setting all properties.function edit3_CreateFcn(hObject, eventdata, handles)% hObject handle to edit3 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles
20、 not created until after all CreateFcns called% Hint: edit controls usually have a white background on Windows.% See ISPC and COMPUTER.if ispc set(hObject,'BackgroundColor','white');else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor');endfunctio
21、n edit4_Callback(hObject, eventdata, handles)% hObject handle to edit4 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% Hints: get(hObject,'String') returns contents of edit4 as text% str2double(get(hObj
22、ect,'String') returns contents of edit4 as a doubleget(hObject,'string');% - Executes during object creation, after setting all properties.function edit4_CreateFcn(hObject, eventdata, handles)% hObject handle to edit4 (see GCBO)% eventdata reserved - to be defined in a future version
23、 of MATLAB% handles empty - handles not created until after all CreateFcns called% Hint: edit controls usually have a white background on Windows.% See ISPC and COMPUTER.if ispc set(hObject,'BackgroundColor','white');else set(hObject,'BackgroundColor',get(0,'defaultUicont
24、rolBackgroundColor');endfunction edit5_Callback(hObject, eventdata, handles)% hObject handle to edit5 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% Hints: get(hObject,'String') returns contents of
25、 edit5 as text% str2double(get(hObject,'String') returns contents of edit5 as a doubleget(hObject,'string');% - Executes during object creation, after setting all properties.function edit5_CreateFcn(hObject, eventdata, handles)% hObject handle to edit5 (see GCBO)% eventdata reserved
26、- to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called% Hint: edit controls usually have a white background on Windows.% See ISPC and COMPUTER.if ispc set(hObject,'BackgroundColor','white');else set(hObject,'Background
27、Color',get(0,'defaultUicontrolBackgroundColor');end2. 设计下图:组合框内可选择sin、cos、csc选项。要求选择某一项则绘制对应的曲线。function varargout = zuoye2(varargin)% ZUOYE2 M-file for zuoye2.fig% ZUOYE2, by itself, creates a new ZUOYE2 or raises the existing% singleton*.% H = ZUOYE2 returns the handle to a new ZUOYE2
28、or the handle to% the existing singleton*.% ZUOYE2('CALLBACK',hObject,eventData,handles,.) calls the local% function named CALLBACK in ZUOYE2.M with the given input arguments.% ZUOYE2('Property','Value',.) creates a new ZUOYE2 or raises the% existing singleton*. Starting from
29、 the left, property value pairs are% applied to the GUI before zuoye2_OpeningFunction gets called. An% unrecognized property name or invalid value makes property application% stop. All inputs are passed to zuoye2_OpeningFcn via varargin.% *See GUI Options on GUIDE's Tools menu. Choose "GUI
30、allows only one% instance to run (singleton)".% See also: GUIDE, GUIDATA, GUIHANDLES% Copyright 2002-2003 The MathWorks, Inc.% Edit the above text to modify the response to help zuoye2% Last Modified by GUIDE v2.5 20-Apr-2014 20:33:01% Begin initialization code - DO NOT EDITgui_Singleton = 1;gu
31、i_State = struct('gui_Name', mfilename, . 'gui_Singleton', gui_Singleton, . 'gui_OpeningFcn', zuoye2_OpeningFcn, . 'gui_OutputFcn', zuoye2_OutputFcn, . 'gui_LayoutFcn', , . 'gui_Callback', );if nargin && ischar(varargin1) gui_State.gui_Callback
32、 = str2func(varargin1);endif nargout varargout1:nargout = gui_mainfcn(gui_State, varargin:);else gui_mainfcn(gui_State, varargin:);end% End initialization code - DO NOT EDIT% - Executes just before zuoye2 is made visible.function zuoye2_OpeningFcn(hObject, eventdata, handles, varargin)% This functio
33、n 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 zuoye2 (see VARARGIN)% Choose default command line output for zuoye2handles
34、.output = hObject;% Update handles structureguidata(hObject, handles);% UIWAIT makes zuoye2 wait for user response (see UIRESUME)% uiwait(handles.figure1);% - Outputs from this function are returned to the command line.function varargout = zuoye2_OutputFcn(hObject, eventdata, handles) % varargout ce
35、ll array for returning output args (see VARARGOUT);% hObject handle to figure% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% Get default command line output from handles structurevarargout1 = handles.output;% - Executes on selection change in
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025年大学心理学(军事心理学)试题及答案
- 制造企业职工安全培训课件
- 工程吊篮安全知识培训课件
- 2026年安全隐患排查治理总结范例(二篇)
- 成本效果分析在高血压合并冠心病干预策略选择中
- 戈谢病基因治疗的个体化剂量调整方案
- 慢阻肺急性加重的雾霾预防性用药方案
- 电子商务交易保密协议
- 低保专项治理工作实施方案
- 2026年软件开发外包风险规避协议
- 2025年广东省春季高考(学考)语文真题(试题+解析)
- 2025中国高等教育质量评估现状与未来发展研究报告
- 智慧方案河套灌区数字孪生灌区建设方案
- 光伏电站安全生产检查表
- 房产盘活管理办法
- 智慧边防AI大模型数字化平台规划设计方案
- 铁路信线维修工实操任务书
- QC/T 476-2025客车防雨密封性要求及试验方法
- 血液透析心律失常护理专题
- 以读促写以写带读:初中语文读写结合教学模式新探
- 认知科学中的注意力机制研究-洞察阐释
评论
0/150
提交评论