SlideShare a Scribd company logo
1 of 23
Gui in Matlab
Group : 4
Topics
About gui
How to create gui with Guide
How to Create a Simple GUI
Programmatically
What Is a GUI?
A graphical user interface (GUI) is a graphical display in one or more
windows containing controls, called components, that enable a user to perform
interactive tasks.
The user of the GUI does not have to create a script or
type commands at the command line to accomplish the tasks.
Unlike coding
programs to accomplish tasks, the user of a GUI need not understand the
details of how the tasks are performed.
GUI components can include menus, toolbars, push buttons, radio buttons,
list boxes, and sliders—just to name a few. GUIs created using MATLAB
tools can also perform any type of computation, read and write data files,
communicate with other GUIs, and display data as tables or as plots.
Sample Gui figure
What in pervious figure ?
The GUI contains
•An axes component
•Apop-up menu listing three data sets that correspond to MATLAB
functions: peaks, membrane,andsinc
•Astatic text component to label the pop-up menu
•Three buttons that provide different kinds of plots: surface, mesh, and
contour
When you click a push button, the axes component displays the selected data
set using the specified type of 3-D plot
Where Do I Start?
Before starting to construct a GUI you have to design it. At a minimum,
You have to decide:
•Who the GUI users will be
•What you want the GUI to do
•How users will interact with the GUI
•What components the GUI requires to function
When designing any software, you need to understand the purposes a new
GUI needs to satisfy. You or the GUI’s potential users should document user
requirements as completely and precisely as possible before starting or build
it. This includes specifying the inputs, outputs, displays, and behaviors of the
GUI and the application it controls. After you design a GUI, you need to
program each of its controls to operate correctly and consistently. Finally, you
should test the completed or prototype GUI to make sure that it behaves as
intended under realistic conditions. (Or better yet, have someone else test it.)
If testing reveals design or programming flaws, iterate the design until the
GUI works to your satisfaction. The following diagram illustrates the main
aspects of this process.
Ways to Build MATLAB GUI
Use GUIDE (GUI Development Environment), an interactive GUI
construction kit.
-------------------------------------------------------------------
•Create code files that generate GUIs as functions or scripts
(programmatic GUI construction).
What Is GUIDE?
GUIDE, the MATLAB Graphical User Interface Development Environment,
provides a set of tools for creating graphical user interfaces (GUIs).
These
tools greatly simplify the process of laying out and programming GUIs.
Type guide to open
Lay Out the Simple GUI in GUIDE
Open a New GUI in the GUIDE Layout Editor
1-Start GUIDE by typing guide at the MATLAB prompt.
Lay Out the Simple GUI in GUIDE
1-Add the three push buttons to the GUI. Select the push button tool from
the component palette at the left side of the Layout Editor and drag it into
the layout area. Create three buttons, positioning them approximately as
Shown in the following figure
2-Add the remaining components to the GUI.
•Astatic text area
•A pop-up menu
•An axes
Arrange the components as shown in the previous figure. Resize the axes
component to approximately 2-by-2 inches.
Align the Components
If several components have the same parent, you can use the Alignment Tool
to align them to one another. To align the three push buttons:
1Select all three push buttons by pressingCtrland clicking them.
2SelectTools > Align Objects
3-Make these settings in the Alignment Tool:
•Left-aligned in the horizontal direction.
•20 pixels spacing between push buttons in the vertical direction.
4- click ok 4
Label the Push Buttons
SelectView > Property Inspector.
Align the Components
If several components have the same parent, you can use the Alignment Tool
to align them to one another. To align the three push buttons:
1-Select all three push buttons by pressing Ctrl and clicking them.
2-SelectTools > Align Objects.
3-Make these settings in the Alignment Tool:
•Left-aligned in the horizontal direction.
•20 pixels spacing between push buttons in the vertical direction
How to Create a Simple
GUI Programmatically
Create the Simple Programmatic GUI Code File
Almost all MATLAB functions work in GUIs. Many functions add components
to GUIs or modify their behavior, others assist in laying out GUIs, and still
others manage data within GUIs.
When you create the simple programmatic GUI code file, you start by creating
a function file (as opposed to a script file, which contains a sequence of
MATLAB commands but does not define functions).
1-At the MATLAB prompt, type edit. MATLAB opens a blank document in
the Editor.
2-Type the following statement into the Editor. This function statement
is the first line in the file.
function simple_gui2
3-Type these comments into the file following the function statement. They
display at the command line in response to the help command. Follow
them by a blank line, which MATLAB requires to terminate the help text.
% SIMPLE_GUI2 Select a data set from the pop-up menu, then
% click one of the plot-type push buttons. Clicking the button
% plots the selected data in the axes.
(Leave a blank line here)
4-Add an end statement at the end of the file. This end statement matches
The function statement. Your file now looks like this.
function simple_gui2
% SIMPLE_GUI2 Select a data set from the pop-up menu, then
% click one of the plot-type push buttons. Clicking the button
% plots the selected data in the axes.
end
5-Save the file in your current folder or at a location that is on your MATLAB
path.
The next section, “Lay Out the Simple Programmatic GUI” on page 3-6, shows
you how to add components to your GUI.
The next section, “Lay Out the Simple Programmatic GUI” on page 3-6, shows
you how to add components to your GUI.
Create a Figure for a Programmatic GUI
In MATLAB software, a GUI is a figure. This first step creates the figure and
Positionsiton the screen.It also makes the GUI invisible so that the GUI
user cannot see the components being added or initialized. When the GUI has
all its components and is initialized, the example makes it visible. Add the
following lines before the end statement currently in your file:
% Create and then hide the GUI as it is being constructed.
f = figure('Visible','off','Position',[360,500,450,285]);
The call to the figure function uses two property/value pairs. The Position
property is a four-element vector that specifies the location of the GUI on the
screen and its size: [distance from left, distance from bottom, width, height].
Default units are pixels.
The next topic, “Add Components to a Programmatic GUI” , shows
you how to add the push buttons, axes, and other components to the GUI
1-Add the three push buttons to your GUI by adding these statements to your
code file following the call tofigure.
% Construct the components.
hsurf = uicontrol('Style','pushbutton',...
'String','Surf','Position',[315,220,70,25]);
hmesh = uicontrol('Style','pushbutton',...
'String','Mesh','Position',[315,180,70,25]);
hcontour = uicontrol('Style','pushbutton',...
'String','Countour','Position',[315,135,70,25]);
These statements use the uicontrol function to create the push buttons.
Each statement uses a series of property/value pairs to define a push
button.
2-Add the pop-up menu and its label to your GUI by adding these statements
to the code file following the push button definitions.
hpopup = uicontrol('Style','popupmenu',...
'String',{'Peaks','Membrane','Sinc'},...
'Position',[300,50,100,25]);
htext = uicontrol('Style','text','String','Select Data',...
'Position',[325,90,60,15]);
3-Add the axes to the GUI by adding this statement to the code file. Set
theUnitsproperty to pixels so that it has the same units as the other
components.
ha = axes('Units','pixels','Position',[50,60,200,185]);
4-Align all components except the axes along their centers with the
following
statement. Add it to the code file following all the component
definitions.
align([hsurf,hmesh,hcontour,htext,hpopup],'Center','None');
5-Make your GUI visible by adding this command following thealign
command.
%Make the GUI visible.
set(f,'Visible','on')
6-This is what your code file should now look like:
6-This is what your code file should now look like:
function simple_gui2
% SIMPLE_GUI2 Select a data set from the pop-up menu, then
% click one of the plot-type push buttons. Clicking the button
% plots the selected data in the axes.
% Create and then hide the GUI as it is being constructed.
f = figure('Visible','off','Position',[360,500,450,285]);
% Construct the components.
hsurf = uicontrol('Style','pushbutton','String','Surf',...
'Position',[315,220,70,25]);
hmesh = uicontrol('Style','pushbutton','String','Mesh',...
'Position',[315,180,70,25]);
hcontour = uicontrol('Style','pushbutton',...
'String','Countour',...
'Position',[315,135,70,25]);
htext = uicontrol('Style','text','String','Select Data',...
'Position',[325,90,60,15]);
hpopup = uicontrol('Style','popupmenu',...
% Construct the components.
hsurf = uicontrol('Style','pushbutton','String','Surf',...
'Position',[315,220,70,25]);
hmesh = uicontrol('Style','pushbutton','String','Mesh',...
'Position',[315,180,70,25]);
hcontour = uicontrol('Style','pushbutton',...
'String','Countour',...
'Position',[315,135,70,25]);
htext = uicontrol('Style','text','String','Select Data',...
'Position',[325,90,60,15]);
hpopup = uicontrol('Style','popupmenu',...
'String',{'Peaks','Membrane','Sinc'},...
'Position',[300,50,100,25]);
ha = axes('Units','Pixels','Position',[50,60,200,185]);
align([hsurf,hmesh,hcontour,htext,hpopup],'Center','None');
%Make the GUI visible.
set(f,'Visible','on')
end

More Related Content

What's hot

Support Vector Machines
Support Vector MachinesSupport Vector Machines
Support Vector Machines
nextlib
 
Gauss Jordan Method
Gauss Jordan MethodGauss Jordan Method
Gauss Jordan Method
ZunAib Ali
 

What's hot (20)

Matlab Introduction
Matlab IntroductionMatlab Introduction
Matlab Introduction
 
Matlab for beginners, Introduction, signal processing
Matlab for beginners, Introduction, signal processingMatlab for beginners, Introduction, signal processing
Matlab for beginners, Introduction, signal processing
 
Graph Theory: Trees
Graph Theory: TreesGraph Theory: Trees
Graph Theory: Trees
 
Introduction to Graph Theory
Introduction to Graph TheoryIntroduction to Graph Theory
Introduction to Graph Theory
 
Introduction to matlab
Introduction to matlabIntroduction to matlab
Introduction to matlab
 
Applications of cross correlation
Applications of cross correlationApplications of cross correlation
Applications of cross correlation
 
Support Vector Machines
Support Vector MachinesSupport Vector Machines
Support Vector Machines
 
LINER SURFACE AND VOLUM INTERGRALS Karishma mansuri
LINER SURFACE AND VOLUM INTERGRALS Karishma mansuriLINER SURFACE AND VOLUM INTERGRALS Karishma mansuri
LINER SURFACE AND VOLUM INTERGRALS Karishma mansuri
 
Introduction to matlab lecture 1 of 4
Introduction to matlab lecture 1 of 4Introduction to matlab lecture 1 of 4
Introduction to matlab lecture 1 of 4
 
Matlab ploting
Matlab plotingMatlab ploting
Matlab ploting
 
Graph theory
Graph theoryGraph theory
Graph theory
 
Gauss Jordan Method
Gauss Jordan MethodGauss Jordan Method
Gauss Jordan Method
 
bat algorithm
bat algorithmbat algorithm
bat algorithm
 
MATLAB INTRODUCTION
MATLAB INTRODUCTIONMATLAB INTRODUCTION
MATLAB INTRODUCTION
 
K10765 Matlab 3D Mesh Plots
K10765 Matlab 3D Mesh PlotsK10765 Matlab 3D Mesh Plots
K10765 Matlab 3D Mesh Plots
 
Introduction to-matlab
Introduction to-matlabIntroduction to-matlab
Introduction to-matlab
 
What is matlab
What is matlabWhat is matlab
What is matlab
 
Importance of matlab
Importance of matlabImportance of matlab
Importance of matlab
 
My presentation minimum spanning tree
My presentation minimum spanning treeMy presentation minimum spanning tree
My presentation minimum spanning tree
 
Matlab matrices and arrays
Matlab matrices and arraysMatlab matrices and arrays
Matlab matrices and arrays
 

Viewers also liked

Muhammad rizwan aqeel rlp.ppt
Muhammad rizwan aqeel rlp.pptMuhammad rizwan aqeel rlp.ppt
Muhammad rizwan aqeel rlp.ppt
M Rizwan Aqeel
 
TIP_E-Conversion_System
TIP_E-Conversion_SystemTIP_E-Conversion_System
TIP_E-Conversion_System
Rana Saini
 
MATLAB TRAINING COURSE IN CHENNAI@MAASTECH/MATLAB
MATLAB TRAINING COURSE IN CHENNAI@MAASTECH/MATLABMATLAB TRAINING COURSE IN CHENNAI@MAASTECH/MATLAB
MATLAB TRAINING COURSE IN CHENNAI@MAASTECH/MATLAB
ASHOKKUMAR RAMAR
 
Presen_Segmentation
Presen_SegmentationPresen_Segmentation
Presen_Segmentation
Vikas Goyal
 
DSBW Final Exam (Spring Sementer 2010)
DSBW Final Exam (Spring Sementer 2010)DSBW Final Exam (Spring Sementer 2010)
DSBW Final Exam (Spring Sementer 2010)
Carles Farré
 
Devanagari Character Recognition
Devanagari Character RecognitionDevanagari Character Recognition
Devanagari Character Recognition
Pulkit Goyal
 
Contoh program matlab
Contoh program matlabContoh program matlab
Contoh program matlab
Zahra Doangs
 

Viewers also liked (20)

GUI in Matlab - 1
GUI in Matlab - 1GUI in Matlab - 1
GUI in Matlab - 1
 
Graphical User Interface (Gui)
Graphical User Interface (Gui)Graphical User Interface (Gui)
Graphical User Interface (Gui)
 
GUI -THESIS123
GUI -THESIS123GUI -THESIS123
GUI -THESIS123
 
Muhammad rizwan aqeel rlp.ppt
Muhammad rizwan aqeel rlp.pptMuhammad rizwan aqeel rlp.ppt
Muhammad rizwan aqeel rlp.ppt
 
Natural Language Checking with Program Checking Tools
Natural Language Checking with Program Checking ToolsNatural Language Checking with Program Checking Tools
Natural Language Checking with Program Checking Tools
 
TIP_E-Conversion_System
TIP_E-Conversion_SystemTIP_E-Conversion_System
TIP_E-Conversion_System
 
MATLAB TRAINING COURSE IN CHENNAI@MAASTECH/MATLAB
MATLAB TRAINING COURSE IN CHENNAI@MAASTECH/MATLABMATLAB TRAINING COURSE IN CHENNAI@MAASTECH/MATLAB
MATLAB TRAINING COURSE IN CHENNAI@MAASTECH/MATLAB
 
Presen_Segmentation
Presen_SegmentationPresen_Segmentation
Presen_Segmentation
 
Text detection and recognition from natural scenes
Text detection and recognition from natural scenesText detection and recognition from natural scenes
Text detection and recognition from natural scenes
 
DSBW Final Exam (Spring Sementer 2010)
DSBW Final Exam (Spring Sementer 2010)DSBW Final Exam (Spring Sementer 2010)
DSBW Final Exam (Spring Sementer 2010)
 
Error control coding
Error control codingError control coding
Error control coding
 
Lecture 09: Localization and Mapping III
Lecture 09: Localization and Mapping IIILecture 09: Localization and Mapping III
Lecture 09: Localization and Mapping III
 
Devanagari Character Recognition
Devanagari Character RecognitionDevanagari Character Recognition
Devanagari Character Recognition
 
Matlab Untuk Pengolahan Citra
Matlab Untuk Pengolahan CitraMatlab Untuk Pengolahan Citra
Matlab Untuk Pengolahan Citra
 
Modul praktikum pengolahan citra digital
Modul praktikum pengolahan citra digitalModul praktikum pengolahan citra digital
Modul praktikum pengolahan citra digital
 
Praktik dengan matlab
Praktik dengan matlabPraktik dengan matlab
Praktik dengan matlab
 
Neural network in matlab
Neural network in matlab Neural network in matlab
Neural network in matlab
 
Pengolahan Citra Digital Dengan Menggunakan MATLAB
Pengolahan Citra Digital Dengan Menggunakan MATLABPengolahan Citra Digital Dengan Menggunakan MATLAB
Pengolahan Citra Digital Dengan Menggunakan MATLAB
 
Advanced MATLAB Tutorial for Engineers & Scientists
Advanced MATLAB Tutorial for Engineers & ScientistsAdvanced MATLAB Tutorial for Engineers & Scientists
Advanced MATLAB Tutorial for Engineers & Scientists
 
Contoh program matlab
Contoh program matlabContoh program matlab
Contoh program matlab
 

Similar to Gui in matlab :

GUI_part_1.pptx
GUI_part_1.pptxGUI_part_1.pptx
GUI_part_1.pptx
Parasuraman43
 

Similar to Gui in matlab : (20)

intro_gui
intro_guiintro_gui
intro_gui
 
Vb%20 tutorial
Vb%20 tutorialVb%20 tutorial
Vb%20 tutorial
 
Howtouse gui _sinmatlab
Howtouse gui _sinmatlabHowtouse gui _sinmatlab
Howtouse gui _sinmatlab
 
Using prime[31] to connect your unity game to azure mobile services
Using prime[31] to connect your unity game to azure mobile servicesUsing prime[31] to connect your unity game to azure mobile services
Using prime[31] to connect your unity game to azure mobile services
 
2 Module - Operating Systems Configuration and Use by Mark John Lado
2 Module - Operating Systems Configuration and Use by Mark John Lado2 Module - Operating Systems Configuration and Use by Mark John Lado
2 Module - Operating Systems Configuration and Use by Mark John Lado
 
GTK+ 2.0 App - Icon Chooser
GTK+ 2.0 App - Icon ChooserGTK+ 2.0 App - Icon Chooser
GTK+ 2.0 App - Icon Chooser
 
GUI ICGST VERY USEFULl.pdf
GUI ICGST VERY USEFULl.pdfGUI ICGST VERY USEFULl.pdf
GUI ICGST VERY USEFULl.pdf
 
Google calendar integration in iOS app
Google calendar integration in iOS appGoogle calendar integration in iOS app
Google calendar integration in iOS app
 
Software engineering modeling lab lectures
Software engineering modeling lab lecturesSoftware engineering modeling lab lectures
Software engineering modeling lab lectures
 
User Tutorial
User TutorialUser Tutorial
User Tutorial
 
Swift
SwiftSwift
Swift
 
Programming Without Coding Technology (PWCT) - Simple GUI Application
Programming Without Coding Technology (PWCT) - Simple GUI ApplicationProgramming Without Coding Technology (PWCT) - Simple GUI Application
Programming Without Coding Technology (PWCT) - Simple GUI Application
 
Visual basic
Visual basicVisual basic
Visual basic
 
Publication Non Visual Components
Publication Non Visual ComponentsPublication Non Visual Components
Publication Non Visual Components
 
ArduinoWorkshop2.pdf
ArduinoWorkshop2.pdfArduinoWorkshop2.pdf
ArduinoWorkshop2.pdf
 
222066369 clad-study-guide
222066369 clad-study-guide222066369 clad-study-guide
222066369 clad-study-guide
 
Model builder in ARC GIS
Model builder in ARC GISModel builder in ARC GIS
Model builder in ARC GIS
 
Matlab Assignment Help
Matlab Assignment HelpMatlab Assignment Help
Matlab Assignment Help
 
Programming Without Coding Technology (PWCT) - Center Window
Programming Without Coding Technology (PWCT) - Center WindowProgramming Without Coding Technology (PWCT) - Center Window
Programming Without Coding Technology (PWCT) - Center Window
 
GUI_part_1.pptx
GUI_part_1.pptxGUI_part_1.pptx
GUI_part_1.pptx
 

Recently uploaded

Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
AnaAcapella
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
ZurliaSoop
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 

Recently uploaded (20)

Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 

Gui in matlab :

  • 2. Topics About gui How to create gui with Guide How to Create a Simple GUI Programmatically
  • 3. What Is a GUI? A graphical user interface (GUI) is a graphical display in one or more windows containing controls, called components, that enable a user to perform interactive tasks. The user of the GUI does not have to create a script or type commands at the command line to accomplish the tasks. Unlike coding programs to accomplish tasks, the user of a GUI need not understand the details of how the tasks are performed. GUI components can include menus, toolbars, push buttons, radio buttons, list boxes, and sliders—just to name a few. GUIs created using MATLAB tools can also perform any type of computation, read and write data files, communicate with other GUIs, and display data as tables or as plots.
  • 5. What in pervious figure ? The GUI contains •An axes component •Apop-up menu listing three data sets that correspond to MATLAB functions: peaks, membrane,andsinc •Astatic text component to label the pop-up menu •Three buttons that provide different kinds of plots: surface, mesh, and contour When you click a push button, the axes component displays the selected data set using the specified type of 3-D plot
  • 6. Where Do I Start? Before starting to construct a GUI you have to design it. At a minimum, You have to decide: •Who the GUI users will be •What you want the GUI to do •How users will interact with the GUI •What components the GUI requires to function When designing any software, you need to understand the purposes a new GUI needs to satisfy. You or the GUI’s potential users should document user requirements as completely and precisely as possible before starting or build it. This includes specifying the inputs, outputs, displays, and behaviors of the GUI and the application it controls. After you design a GUI, you need to program each of its controls to operate correctly and consistently. Finally, you should test the completed or prototype GUI to make sure that it behaves as intended under realistic conditions. (Or better yet, have someone else test it.) If testing reveals design or programming flaws, iterate the design until the GUI works to your satisfaction. The following diagram illustrates the main aspects of this process.
  • 7. Ways to Build MATLAB GUI Use GUIDE (GUI Development Environment), an interactive GUI construction kit. ------------------------------------------------------------------- •Create code files that generate GUIs as functions or scripts (programmatic GUI construction).
  • 8. What Is GUIDE? GUIDE, the MATLAB Graphical User Interface Development Environment, provides a set of tools for creating graphical user interfaces (GUIs). These tools greatly simplify the process of laying out and programming GUIs. Type guide to open Lay Out the Simple GUI in GUIDE Open a New GUI in the GUIDE Layout Editor 1-Start GUIDE by typing guide at the MATLAB prompt.
  • 9. Lay Out the Simple GUI in GUIDE
  • 10.
  • 11.
  • 12. 1-Add the three push buttons to the GUI. Select the push button tool from the component palette at the left side of the Layout Editor and drag it into the layout area. Create three buttons, positioning them approximately as Shown in the following figure 2-Add the remaining components to the GUI. •Astatic text area •A pop-up menu •An axes Arrange the components as shown in the previous figure. Resize the axes component to approximately 2-by-2 inches. Align the Components If several components have the same parent, you can use the Alignment Tool to align them to one another. To align the three push buttons: 1Select all three push buttons by pressingCtrland clicking them. 2SelectTools > Align Objects
  • 13. 3-Make these settings in the Alignment Tool: •Left-aligned in the horizontal direction. •20 pixels spacing between push buttons in the vertical direction. 4- click ok 4 Label the Push Buttons SelectView > Property Inspector.
  • 14. Align the Components If several components have the same parent, you can use the Alignment Tool to align them to one another. To align the three push buttons: 1-Select all three push buttons by pressing Ctrl and clicking them. 2-SelectTools > Align Objects. 3-Make these settings in the Alignment Tool: •Left-aligned in the horizontal direction. •20 pixels spacing between push buttons in the vertical direction
  • 15. How to Create a Simple GUI Programmatically Create the Simple Programmatic GUI Code File Almost all MATLAB functions work in GUIs. Many functions add components to GUIs or modify their behavior, others assist in laying out GUIs, and still others manage data within GUIs. When you create the simple programmatic GUI code file, you start by creating a function file (as opposed to a script file, which contains a sequence of MATLAB commands but does not define functions).
  • 16. 1-At the MATLAB prompt, type edit. MATLAB opens a blank document in the Editor. 2-Type the following statement into the Editor. This function statement is the first line in the file. function simple_gui2 3-Type these comments into the file following the function statement. They display at the command line in response to the help command. Follow them by a blank line, which MATLAB requires to terminate the help text. % SIMPLE_GUI2 Select a data set from the pop-up menu, then % click one of the plot-type push buttons. Clicking the button % plots the selected data in the axes. (Leave a blank line here)
  • 17. 4-Add an end statement at the end of the file. This end statement matches The function statement. Your file now looks like this. function simple_gui2 % SIMPLE_GUI2 Select a data set from the pop-up menu, then % click one of the plot-type push buttons. Clicking the button % plots the selected data in the axes. end 5-Save the file in your current folder or at a location that is on your MATLAB path. The next section, “Lay Out the Simple Programmatic GUI” on page 3-6, shows you how to add components to your GUI. The next section, “Lay Out the Simple Programmatic GUI” on page 3-6, shows you how to add components to your GUI.
  • 18. Create a Figure for a Programmatic GUI In MATLAB software, a GUI is a figure. This first step creates the figure and Positionsiton the screen.It also makes the GUI invisible so that the GUI user cannot see the components being added or initialized. When the GUI has all its components and is initialized, the example makes it visible. Add the following lines before the end statement currently in your file: % Create and then hide the GUI as it is being constructed. f = figure('Visible','off','Position',[360,500,450,285]); The call to the figure function uses two property/value pairs. The Position property is a four-element vector that specifies the location of the GUI on the screen and its size: [distance from left, distance from bottom, width, height]. Default units are pixels. The next topic, “Add Components to a Programmatic GUI” , shows you how to add the push buttons, axes, and other components to the GUI
  • 19. 1-Add the three push buttons to your GUI by adding these statements to your code file following the call tofigure. % Construct the components. hsurf = uicontrol('Style','pushbutton',... 'String','Surf','Position',[315,220,70,25]); hmesh = uicontrol('Style','pushbutton',... 'String','Mesh','Position',[315,180,70,25]); hcontour = uicontrol('Style','pushbutton',... 'String','Countour','Position',[315,135,70,25]); These statements use the uicontrol function to create the push buttons. Each statement uses a series of property/value pairs to define a push button.
  • 20. 2-Add the pop-up menu and its label to your GUI by adding these statements to the code file following the push button definitions. hpopup = uicontrol('Style','popupmenu',... 'String',{'Peaks','Membrane','Sinc'},... 'Position',[300,50,100,25]); htext = uicontrol('Style','text','String','Select Data',... 'Position',[325,90,60,15]); 3-Add the axes to the GUI by adding this statement to the code file. Set theUnitsproperty to pixels so that it has the same units as the other components. ha = axes('Units','pixels','Position',[50,60,200,185]);
  • 21. 4-Align all components except the axes along their centers with the following statement. Add it to the code file following all the component definitions. align([hsurf,hmesh,hcontour,htext,hpopup],'Center','None'); 5-Make your GUI visible by adding this command following thealign command. %Make the GUI visible. set(f,'Visible','on') 6-This is what your code file should now look like:
  • 22. 6-This is what your code file should now look like: function simple_gui2 % SIMPLE_GUI2 Select a data set from the pop-up menu, then % click one of the plot-type push buttons. Clicking the button % plots the selected data in the axes. % Create and then hide the GUI as it is being constructed. f = figure('Visible','off','Position',[360,500,450,285]); % Construct the components. hsurf = uicontrol('Style','pushbutton','String','Surf',... 'Position',[315,220,70,25]); hmesh = uicontrol('Style','pushbutton','String','Mesh',... 'Position',[315,180,70,25]); hcontour = uicontrol('Style','pushbutton',... 'String','Countour',... 'Position',[315,135,70,25]); htext = uicontrol('Style','text','String','Select Data',... 'Position',[325,90,60,15]); hpopup = uicontrol('Style','popupmenu',...
  • 23. % Construct the components. hsurf = uicontrol('Style','pushbutton','String','Surf',... 'Position',[315,220,70,25]); hmesh = uicontrol('Style','pushbutton','String','Mesh',... 'Position',[315,180,70,25]); hcontour = uicontrol('Style','pushbutton',... 'String','Countour',... 'Position',[315,135,70,25]); htext = uicontrol('Style','text','String','Select Data',... 'Position',[325,90,60,15]); hpopup = uicontrol('Style','popupmenu',... 'String',{'Peaks','Membrane','Sinc'},... 'Position',[300,50,100,25]); ha = axes('Units','Pixels','Position',[50,60,200,185]); align([hsurf,hmesh,hcontour,htext,hpopup],'Center','None'); %Make the GUI visible. set(f,'Visible','on') end