当前位置:高等教育资讯网  >  中国高校课件下载中心  >  大学文库  >  浏览文档

同济大学:《Matlab在机械设计中的应用》课程电子教案(PPT课件)Chapter 10 Graphical User Interface

资源类别:文库,文档格式:PPT,文档页数:60,文件大小:4.2MB,团购合买
点击下载完整版文档(PPT)

Graphical User Interface(1/60) Introduction > MatLab provides Graphical User Interface Development Environment(GUIDE) > Components-- Graphical Components: pushbuttons,edit boxes,sliders,labels,menus,.. Static Components: frames,text strings,... > Callbacks-- The functions which perform the required action when a component is pushed 翻日济大学 AW TONGJI UNIVERSITY

➢ MatLab provides Graphical User Interface Development Environment(GUIDE) ➢ Components -- Graphical Components: pushbuttons, edit boxes, sliders, labels, menus, … Static Components: frames, text strings,… ➢ Callbacks-- The functions which perform the required action when a component is pushed Graphical User Interface(1/60) Introduction

Graphical User Interface(2/60) Guide Guide is an interactive tool for designing and building Graphical User Interfaces (GUD)for your Matlab applications. > GUI building process involves: Designing of the user interface and layout (The looks!) Programming of the GUI and its components (The works! Testing,debugging and finally running it. PHAW @月停大学 TONGJI UNIVERSITY

➢ Guide is an interactive tool for designing and building Graphical User Interfaces (GUI) for your Matlab applications. ➢ GUI building process involves: • Designing of the user interface and layout ( The looks!) • Programming of the GUI and its components (The works!) • Testing, debugging and finally running it. Graphical User Interface(2/60) Guide

Graphical User Interface(3/60) Guide > Either click on the Guide Icon on the Matlab-Toolbar or type guide on the command window. > This will open the Quickstart GUI template selection window. Matlab provides a few templates to help with the common GUI design task but these are limited in numbers and you will probably need to start with a blank template. > The initial layout area is usually resizable by clicking and dragging the handles on the corners of the template area. PHAW @日济大学 TONGJI UNIVERSITY

➢ Either click on the Guide Icon on the Matlab-Toolbar or type guide on the command window. ➢ This will open the Quickstart GUI template selection window. Matlab provides a few templates to help with the common GUI design task but these are limited in numbers and you will probably need to start with a blank template. ➢ The initial layout area is usually resizable by clicking and dragging the handles on the corners of the template area. Graphical User Interface(3/60) Guide

Graphical User Interface(4/60) Guide Alignment tool Menu Editor M-file editor Property RUN Inspector ☒untit1ed.ti 四▣☒ layout area x CDHAW @月协大学 TONGJI UNIVERSITY

Graphical User Interface(4/60) Guide Alignment tool Menu Editor M-file editor Property Inspector RUN layout area

Graphical User Interface(5/60) Guide The Guide window contains the components palette.Your layout-design task will involve dragging and dropping the GUI control components from the palette onto the layout area. > File->Preferences option of the GUIDE window will allow you to display the names of the items in the components palette via the Guide:Preferences Show Names in the components palette. @日济大学 AW TONGJI UNIVERSITY

➢ The Guide window contains the components palette. Your layout-design task will involve dragging and dropping the GUI control components from the palette onto the layout area. ➢ File-> Preferences option of the GUIDE window will allow you to display the names of the items in the components palette via the Guide: Preferences > Show Names in the components palette. Graphical User Interface(5/60) Guide

Graphical User Interface(6/60) Guide Alignment tool Menu Editor M-file editor Property RUN Inspector untitlod.fig 因▣8 D它日出B色个串必▣图哈P Select Push Button Slider Radio Button components ☑Check Box palette Edit Text layout area m Static Text 3 Pop-up Menu 雪到Listbox 画Toggle Button Axes Panel Button Group XActiveX Control @月停大学 TONGJI UNIVERSITY

Graphical User Interface(6/60) Guide Alignment tool Menu Editor M-file editor Property Inspector RUN layout area components palette

Graphical User Interface(7/60) Uicontrol Objects The user interface will usually be made up of: Toolbars&Menus 。 Input Control components such as Push Buttons,Radio Buttons,Check Boxes (SWITCHES) Pop-up Menus,List-Boxes (SELECTIONS) Sliders (CONTINIOUS CONTROL Edit Text (TEXT method of input) ·Graphical Objects Axes Objects Text Objects Static Text @日济大学 AW TONGJI UNIVERSITY

➢ The user interface will usually be made up of : • Toolbars & Menus • Input Control components such as : Push Buttons, Radio Buttons, Check Boxes ( SWITCHES) Pop-up Menus, List-Boxes ( SELECTIONS) Sliders ( CONTINIOUS CONTROL ) Edit Text ( TEXT method of input ) • Graphical Objects Axes Objects • Text Objects Static Text Graphical User Interface(7/60) Uicontrol Objects

Graphical User Interface(8/60) Uicontrol Objects Figure No.1 回☒ Eile Edit Tools Window Help 07 Frame 06 FRAME 0.5 Push Button 04 Push Button Radio Button 0.3 Toggle Button 02 List Box Slider Toggle Button Edit Text 0.1 Pop-up Menu 0 0.1 02 03 0.5 0.6 0.7 Static Text Check. Check Box CRadio Bu Box SLIDER List Box @大学 AW TONGJI UNIVERSITY

Graphical User Interface(8/60) Uicontrol Objects Push Button Frame Toggle Button Pop-up Menu Static Text Slider Edit Text List Box Radio Button Check Box

Graphical User Interface(9/60) Uicontrol Objects > Edit Text Edit Text Used in situations that require the user to enter strings or characters or numbers. A variable.You can call it anything. >>K-get(hObject,'string); Retrieves the 'string' entered by user. If you entered abc'into the Edit Text,then the command above will make K=abc' @日济大学 AW TONGJI UNIVERSITY

➢ Edit Text Used in situations that require the user to enter strings or characters or numbers. >>K=get(hObject,'string'); If you entered ‘abc’ into the Edit Text, then the command above will make K = ‘abc’ Graphical User Interface(9/60) Uicontrol Objects A variable. You can call it anything. Retrieves the ‘string’ entered by user

Graphical User Interface(10/60) Uicontrol Objects At this point,K is a string.If the user enters a number,it will still be a string. To change it to a number: >>K num=str2double(K); To pass the variable K for processing (to another Callback): Another variable.But must be in >>handles.K=K; the format 'handles.anyname' >>guidata(hObject,handles); Standard command line used to @大学 save'all handles information. TONGJI UNIVERSITY

At this point, K is a string. If the user enters a number, it will still be a string. To change it to a number: >>K_num=str2double(K); To pass the variable K for processing (to another Callback): >>handles.K=K; >>guidata(hObject,handles); Graphical User Interface(10/60) Uicontrol Objects Another variable. But must be in the format ‘handles.anyname’ Standard command line used to ‘save’ all handles information

点击下载完整版文档(PPT)VIP每日下载上限内不扣除下载券和下载次数;
按次数下载不扣除下载券;
24小时内重复下载只扣除一次;
顺序:VIP每日次数-->可用次数-->下载券;
共60页,可试读20页,点击继续阅读 ↓↓
相关文档

关于我们|帮助中心|下载说明|相关软件|意见反馈|联系我们

Copyright © 2008-现在 cucdc.com 高等教育资讯网 版权所有