版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
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. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2026届青海省海东市高考适应性考试历史试卷含解析
- 2026平城区语文面试题目及答案
- 2026青岛销售面试题及答案
- 2026全民疫苗面试题库及答案
- 2026审计局面试题目及答案
- 管道疏通雇用协议书
- 互不追偿协议书
- 教师投递结对协议书
- 自动离职签字协议书
- 加油油票合同范本
- 胫腓骨骨折手术后功能锻炼指南
- GB/T 27664.3-2026无损检测仪器超声检测设备的性能与检验第3部分:组合设备
- 环保业务咨询介绍
- 四川发展集团招聘笔试真题
- DB3201∕T 1016-2020 芦蒿软腐病综合防治技术规程
- 变压器安装吊装施工方案
- 2025年企业销售顾问招聘面试题库及参考答案
- 机房不间断电源(UPS)设计方案
- 供电服务指挥中心
- DB11∕T 1062-2022 人员疏散掩蔽标志设计与设置
- 老年人认知症培训课件
评论
0/150
提交评论