




版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
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年度船舶建造与设计合同年度更新
- 2025年度跨境电商代理记账与税务合规支持协议
- 2025年度人工智能技术研发合作协议(全新版)
- 2025年度创意产业园区租赁合同及创业支持协议
- 2025年度租赁合同范本(含违约责任)
- 持续反馈机制的建立与实施计划
- 加强数据安全管理的实施措施计划
- 2025年CO2气体保护药芯焊丝合作协议书
- 定期举办学术交流活动计划
- 生产计划科学制定
- 医院医疗质量管理委员会会议记录五篇
- 火电厂消防培训课件
- 工厂物料损耗状况和人为因素和差异清查步骤与方法讲解培训课件
- 精神障碍患者的生活技能培训
- 《系统解剖学》期末考试复习题库大全-下(多选题汇总)
- 中医护理技术-麦粒灸 悬灸 穴位注射-培训课件
- 烧掉数学书:重新发明数学
- 厦门弘爱医院硼中子俘获治疗系统项目环境影响报告
- 酒店招标文件内容
- 腹腔镜胃癌根治术护理教学查房
- 【茶道】宋代点茶道详解
评论
0/150
提交评论