SlideShare a Scribd company logo
Basic Calculator using GUI in MATLAB
Narayan Lal Menariya
ABSTRACT : A Calculator has been created by using
GUI(graphical user interface) which can perform basic
operations like addition , subtraction etc.
GUI is created by using functions and handles for
various pushbuttons and text to display the results and
mathematical operations.
GUI : Stands for Graphical User Interface and is
pronounced "gooey." It is a user interface that includes
graphical elements, such as windows, icons and
buttons.
In this project by using GUI we designed a basic
calculator in which general operations can be perform
like addition ,subtraction, multiplication etc.
ALGORITHM:
 Create a main function calculator
 Define handles for various Pushbutton (1,2,...9,+,-
,*,/ etc) like :
Zero = uicontrol(f,'style','pushbutton','string','0','pos',[20 20 110 50],...
'callback',@PushButton_zero);
Here zero is a handle.
Uicontrol : Create user interface control object.
 Define handle for Text button
 Call a function using handles
PROGRAM:
function guide_calculator()
f = figure('color','r','pos',[100 100 600 400]);
Zero = uicontrol(f,'style','pushbutton','string','0','pos',[20 20 110
50],...
'callback',@PushButton_zero);
Dot = uicontrol(f,'style','pushbutton','string','.','pos',[140 20 50
50],...
'callback',@PushButton_dot);
Equal = uicontrol(f,'style','pushbutton','string','=','pos',[200 20 50
110],...
'callback',@PushButton_equal);
One = uicontrol(f,'style','pushbutton','string','1','pos',[20 80 50 50],...
'callback',@PushButton_one);
Two = uicontrol(f,'style','pushbutton','string','2','pos',[80 80 50 50],...
'callback',@PushButton_two);
Three = uicontrol(f,'style','pushbutton','string','3','pos',[140 80 50
50],...
'callback',@PushButton_three);
Four = uicontrol(f,'style','pushbutton','string','4','pos',[20 140 50
50],...
'callback',@PushButton_four);
Five = uicontrol(f,'style','pushbutton','string','5','pos',[80 140 50
50],...
'callback',@PushButton_five);
Six = uicontrol(f,'style','pushbutton','string','6','pos',[140 140 50
50],...
'callback',@PushButton_six);
Multiply = uicontrol(f,'style','pushbutton','string','*','pos',[200 140 50
50],...
'callback',@PushButton_multiply);
Seven = uicontrol(f,'style','pushbutton','string','7','pos',[20 200 50
50],...
'callback',@PushButton_seven);
Eight = uicontrol(f,'style','pushbutton','string','8','pos',[80 200 50
50],...
'callback',@PushButton_eight);
Nine = uicontrol(f,'style','pushbutton','string','9','pos',[140 200 50
50],...
'callback',@PushButton_nine);
Divide = uicontrol(f,'style','pushbutton','string','/','pos',[200 200 50
50],...
'callback',@PushButton_divide);
Removelast = uicontrol(f,'style','pushbutton','string','<--','pos',[20 260
50 50],...
'callback',@PushButton_remove);
ClearAll = uicontrol(f,'style','pushbutton','string','CE','pos',[80 260 50
50],...
'callback',@PushButton_clear);
Minus = uicontrol(f,'style','pushbutton','string','-','pos',[140 260 50
50],...
'callback',@PushButton_minus);
Plus = uicontrol(f,'style','pushbutton','string','+','pos',[200 260 50
50],...
'callback',@PushButton_plus);
Text = uicontrol(f,'style','text','pos',[20 320 230 50],...
'callback',@edittext);
function PushButton_zero(Zero,b)
display('0')
q = get(Text,'string');
set(Text,'string',strcat(q,'0'));
end
function PushButton_dot(Dot,b)
display('.')
%set(Text,'string','.')
q = get(Text,'string');
set(Text,'string',strcat(q,'.'));
end
function PushButton_plus(Plus,b)
display('+')
%set(Text,'string','+')
q = get(Text,'string');
set(Text,'string',strcat(q,'+'));
end
function PushButton_one(One,b)
display('1')
%set(Text,'string','1')
q = get(Text,'string');
set(Text,'string',strcat(q,'1'));
end
function PushButton_two(Two,b)
display('2')
%set(Text,'string','2')
q = get(Text,'string');
set(Text,'string',strcat(q,'2'));
end
function PushButton_three(Three,b)
display('3')
%set(Text,'string','3')
q = get(Text,'string');
set(Text,'string',strcat(q,'3'));
end
function PushButton_minus(Minus,b)
display('-')
%set(Text,'string','-')
q = get(Text,'string');
set(Text,'string',strcat(q,'-'));
end
function PushButton_four(Four,b)
display('4')
%set(Text,'string','4')
q = get(Text,'string');
set(Text,'string',strcat(q,'4'));
end
function PushButton_five(Five,b)
display('5')
%set(Text,'string','5')
q = get(Text,'string');
set(Text,'string',strcat(q,'5'));
end
function PushButton_six(Six,b)
display('6')
% set(Text,'string','6')
q = get(Text,'string');
set(Text,'string',strcat(q,'6'));
end
function PushButton_multiply(Multiply,b)
display('*')
%set(Text,'string''*')
q = get(Text,'string');
set(Text,'string',strcat(q,'*'));
end
function PushButton_seven(Seven,b)
display('7')
%set(Text,'string','7')
q = get(Text,'string');
set(Text,'string',strcat(q,'7'));
end
function PushButton_eight(Eight,b)
display('8')
%set(Text,'string','8')
q = get(Text,'string');
set(Text,'string',strcat(q,'8'));
end
function PushButton_nine(Nine,b)
display('9')
%set(Text,'string','9')
q = get(Text,'string');
set(Text,'string',strcat(q,'9'));
end
function PushButton_divide(Divide,b)
display('/')
%set(Text,'string','/')
q = get(Text,'string');
set(Text,'string',strcat(q,'/'));
end
function PushButton_clear(ClearAll,b)
set(Text,'string','0');
display(0)
end
function PushButton_remove(Removelast,b)
q = get(Text,'string');
q1 = size(q);
set(Text,'string',q(1:q1(2)-1));
end
function PushButton_equal(Equal,b)
a = eval(get(Text,'string'));
display(a)
set(Text,'string',a);
size(a)
end
end
CALCULATOR:
CONCLUSION : In this project a basic calculator has been
designed and further it can be modified as a scientific calculator
and other operations can also be added.

More Related Content

What's hot

Python Functions Tutorial | Working With Functions In Python | Python Trainin...
Python Functions Tutorial | Working With Functions In Python | Python Trainin...Python Functions Tutorial | Working With Functions In Python | Python Trainin...
Python Functions Tutorial | Working With Functions In Python | Python Trainin...
Edureka!
 
Tuple in python
Tuple in pythonTuple in python
Tuple in python
Sharath Ankrajegowda
 
Datatype in JavaScript
Datatype in JavaScriptDatatype in JavaScript
Datatype in JavaScript
Rajat Saxena
 
Python-List.pptx
Python-List.pptxPython-List.pptx
Python-List.pptx
AnitaDevi158873
 
Tkinter_GUI_Programming_in_Python.pdf
Tkinter_GUI_Programming_in_Python.pdfTkinter_GUI_Programming_in_Python.pdf
Tkinter_GUI_Programming_in_Python.pdf
ArielManzano3
 
AWT Packages , Containers and Components
AWT Packages , Containers and ComponentsAWT Packages , Containers and Components
AWT Packages , Containers and Components
Sohanur63
 
Data visualization in Python
Data visualization in PythonData visualization in Python
Data visualization in Python
Marc Garcia
 
Python array
Python arrayPython array
Python array
Arnab Chakraborty
 
Number Guessing Game
Number Guessing GameNumber Guessing Game
Number Guessing Game
Manish Kumar
 
NumPy
NumPyNumPy
Departmental store management sytem
Departmental store management sytemDepartmental store management sytem
Departmental store management sytem
jatin hingorani
 
Input processing and output in Python
Input processing and output in PythonInput processing and output in Python
Input processing and output in Python
Raajendra M
 
Python Libraries and Modules
Python Libraries and ModulesPython Libraries and Modules
Python Libraries and Modules
RaginiJain21
 
Python Data Types.pdf
Python Data Types.pdfPython Data Types.pdf
Python Data Types.pdf
NehaSpillai1
 
NumPy/SciPy Statistics
NumPy/SciPy StatisticsNumPy/SciPy Statistics
NumPy/SciPy Statistics
Enthought, Inc.
 
Basics of Object Oriented Programming in Python
Basics of Object Oriented Programming in PythonBasics of Object Oriented Programming in Python
Basics of Object Oriented Programming in Python
Sujith Kumar
 
K mean-clustering algorithm
K mean-clustering algorithmK mean-clustering algorithm
K mean-clustering algorithm
parry prabhu
 
Visual Basic IDE Introduction
Visual Basic IDE IntroductionVisual Basic IDE Introduction
Visual Basic IDE Introduction
Ahllen Javier
 

What's hot (20)

Python Functions Tutorial | Working With Functions In Python | Python Trainin...
Python Functions Tutorial | Working With Functions In Python | Python Trainin...Python Functions Tutorial | Working With Functions In Python | Python Trainin...
Python Functions Tutorial | Working With Functions In Python | Python Trainin...
 
Tuple in python
Tuple in pythonTuple in python
Tuple in python
 
Datatype in JavaScript
Datatype in JavaScriptDatatype in JavaScript
Datatype in JavaScript
 
Python-List.pptx
Python-List.pptxPython-List.pptx
Python-List.pptx
 
Tkinter_GUI_Programming_in_Python.pdf
Tkinter_GUI_Programming_in_Python.pdfTkinter_GUI_Programming_in_Python.pdf
Tkinter_GUI_Programming_in_Python.pdf
 
Oop concepts in python
Oop concepts in pythonOop concepts in python
Oop concepts in python
 
AWT Packages , Containers and Components
AWT Packages , Containers and ComponentsAWT Packages , Containers and Components
AWT Packages , Containers and Components
 
Data visualization in Python
Data visualization in PythonData visualization in Python
Data visualization in Python
 
Python array
Python arrayPython array
Python array
 
Number Guessing Game
Number Guessing GameNumber Guessing Game
Number Guessing Game
 
NumPy
NumPyNumPy
NumPy
 
Departmental store management sytem
Departmental store management sytemDepartmental store management sytem
Departmental store management sytem
 
Input processing and output in Python
Input processing and output in PythonInput processing and output in Python
Input processing and output in Python
 
Sets in python
Sets in pythonSets in python
Sets in python
 
Python Libraries and Modules
Python Libraries and ModulesPython Libraries and Modules
Python Libraries and Modules
 
Python Data Types.pdf
Python Data Types.pdfPython Data Types.pdf
Python Data Types.pdf
 
NumPy/SciPy Statistics
NumPy/SciPy StatisticsNumPy/SciPy Statistics
NumPy/SciPy Statistics
 
Basics of Object Oriented Programming in Python
Basics of Object Oriented Programming in PythonBasics of Object Oriented Programming in Python
Basics of Object Oriented Programming in Python
 
K mean-clustering algorithm
K mean-clustering algorithmK mean-clustering algorithm
K mean-clustering algorithm
 
Visual Basic IDE Introduction
Visual Basic IDE IntroductionVisual Basic IDE Introduction
Visual Basic IDE Introduction
 

Similar to GUI based calculator using MATLAB

Final project report
Final project reportFinal project report
Final project reportssuryawanshi
 
Initial UI Mockup - Part 2.pdf
Initial UI Mockup - Part 2.pdfInitial UI Mockup - Part 2.pdf
Initial UI Mockup - Part 2.pdf
ShaiAlmog1
 
Gui in matlab :
Gui in matlab :Gui in matlab :
Gui in matlab :
elboob2025
 
PPThbkjn;l sdc a;s'jjN djkHBSDjhhIDoj LKD
PPThbkjn;l sdc a;s'jjN djkHBSDjhhIDoj LKDPPThbkjn;l sdc a;s'jjN djkHBSDjhhIDoj LKD
PPThbkjn;l sdc a;s'jjN djkHBSDjhhIDoj LKD
chessvashisth
 
Question Hello, I need some assistance in writing a java pr...Hel.pdf
Question Hello, I need some assistance in writing a java pr...Hel.pdfQuestion Hello, I need some assistance in writing a java pr...Hel.pdf
Question Hello, I need some assistance in writing a java pr...Hel.pdf
hainesburchett26321
 
Data Handling
Data Handling Data Handling
Data Handling
bharath916489
 
How to develop a Graphical User Interface (GUI) in Scilab
How to develop a Graphical User Interface (GUI) in ScilabHow to develop a Graphical User Interface (GUI) in Scilab
How to develop a Graphical User Interface (GUI) in Scilab
Scilab
 
Lhy tutorial gui(1)
Lhy tutorial gui(1)Lhy tutorial gui(1)
Lhy tutorial gui(1)
Brijesh Naik
 
OOP program questions with answers
OOP program questions with answersOOP program questions with answers
OOP program questions with answers
Quratulain Naqvi
 
CSE 103 Project Presentation.pptx
CSE 103 Project Presentation.pptxCSE 103 Project Presentation.pptx
CSE 103 Project Presentation.pptx
TasnimSaimaRaita
 
Presentation for structure in c
Presentation for  structure in cPresentation for  structure in c
Presentation for structure in c
MdSaydurRahmanRifat
 
Hello, I need some assistance in writing a java program THAT MUST US.pdf
Hello, I need some assistance in writing a java program THAT MUST US.pdfHello, I need some assistance in writing a java program THAT MUST US.pdf
Hello, I need some assistance in writing a java program THAT MUST US.pdf
FashionColZone
 
python.pdf
python.pdfpython.pdf
python.pdf
SwapnilGujar10
 
intro_gui
intro_guiintro_gui
intro_gui
filipb2
 
The Ring programming language version 1.2 book - Part 34 of 84
The Ring programming language version 1.2 book - Part 34 of 84The Ring programming language version 1.2 book - Part 34 of 84
The Ring programming language version 1.2 book - Part 34 of 84
Mahmoud Samir Fayed
 
Introduction to python programming
Introduction to python programmingIntroduction to python programming
Introduction to python programming
Rakotoarison Louis Frederick
 
matlab.code.has.docx
matlab.code.has.docxmatlab.code.has.docx
matlab.code.has.docx
ssuserfe37cb
 
Computer_Practicals-file.doc.pdf
Computer_Practicals-file.doc.pdfComputer_Practicals-file.doc.pdf
Computer_Practicals-file.doc.pdf
HIMANSUKUMAR12
 

Similar to GUI based calculator using MATLAB (20)

Final project report
Final project reportFinal project report
Final project report
 
Initial UI Mockup - Part 2.pdf
Initial UI Mockup - Part 2.pdfInitial UI Mockup - Part 2.pdf
Initial UI Mockup - Part 2.pdf
 
Gui in matlab :
Gui in matlab :Gui in matlab :
Gui in matlab :
 
PPThbkjn;l sdc a;s'jjN djkHBSDjhhIDoj LKD
PPThbkjn;l sdc a;s'jjN djkHBSDjhhIDoj LKDPPThbkjn;l sdc a;s'jjN djkHBSDjhhIDoj LKD
PPThbkjn;l sdc a;s'jjN djkHBSDjhhIDoj LKD
 
Question Hello, I need some assistance in writing a java pr...Hel.pdf
Question Hello, I need some assistance in writing a java pr...Hel.pdfQuestion Hello, I need some assistance in writing a java pr...Hel.pdf
Question Hello, I need some assistance in writing a java pr...Hel.pdf
 
Data Handling
Data Handling Data Handling
Data Handling
 
How to develop a Graphical User Interface (GUI) in Scilab
How to develop a Graphical User Interface (GUI) in ScilabHow to develop a Graphical User Interface (GUI) in Scilab
How to develop a Graphical User Interface (GUI) in Scilab
 
Lhy tutorial gui(1)
Lhy tutorial gui(1)Lhy tutorial gui(1)
Lhy tutorial gui(1)
 
OOP program questions with answers
OOP program questions with answersOOP program questions with answers
OOP program questions with answers
 
CSE 103 Project Presentation.pptx
CSE 103 Project Presentation.pptxCSE 103 Project Presentation.pptx
CSE 103 Project Presentation.pptx
 
Presentation for structure in c
Presentation for  structure in cPresentation for  structure in c
Presentation for structure in c
 
Hello, I need some assistance in writing a java program THAT MUST US.pdf
Hello, I need some assistance in writing a java program THAT MUST US.pdfHello, I need some assistance in writing a java program THAT MUST US.pdf
Hello, I need some assistance in writing a java program THAT MUST US.pdf
 
python.pdf
python.pdfpython.pdf
python.pdf
 
I os 15
I os 15I os 15
I os 15
 
intro_gui
intro_guiintro_gui
intro_gui
 
The Ring programming language version 1.2 book - Part 34 of 84
The Ring programming language version 1.2 book - Part 34 of 84The Ring programming language version 1.2 book - Part 34 of 84
The Ring programming language version 1.2 book - Part 34 of 84
 
Introduction to python programming
Introduction to python programmingIntroduction to python programming
Introduction to python programming
 
Of class2
Of class2Of class2
Of class2
 
matlab.code.has.docx
matlab.code.has.docxmatlab.code.has.docx
matlab.code.has.docx
 
Computer_Practicals-file.doc.pdf
Computer_Practicals-file.doc.pdfComputer_Practicals-file.doc.pdf
Computer_Practicals-file.doc.pdf
 

More from NarayanlalMenariya

Updated CV
Updated CVUpdated CV
Updated CV
NarayanlalMenariya
 
Curriculum Vitae
Curriculum VitaeCurriculum Vitae
Curriculum Vitae
NarayanlalMenariya
 
Face Detection And Tracking
Face Detection And TrackingFace Detection And Tracking
Face Detection And Tracking
NarayanlalMenariya
 
Resume for fresher
Resume for fresherResume for fresher
Resume for fresher
NarayanlalMenariya
 
C++ Programs
C++ ProgramsC++ Programs
C++ Programs
NarayanlalMenariya
 
Character recognition
Character recognitionCharacter recognition
Character recognition
NarayanlalMenariya
 
Steganography
SteganographySteganography
Steganography
NarayanlalMenariya
 
client-server communication using socket IPC
client-server communication using socket IPCclient-server communication using socket IPC
client-server communication using socket IPC
NarayanlalMenariya
 
Message queue and shared memory
Message queue and shared memoryMessage queue and shared memory
Message queue and shared memory
NarayanlalMenariya
 
Synchronization of shared memory using semaphores
Synchronization of shared memory using semaphoresSynchronization of shared memory using semaphores
Synchronization of shared memory using semaphores
NarayanlalMenariya
 
Home automation using MATLAB image processing
Home automation using MATLAB image processingHome automation using MATLAB image processing
Home automation using MATLAB image processing
NarayanlalMenariya
 
Simplified Experimental Determination of Line Transient Immunity of Linear Re...
Simplified Experimental Determination of Line Transient Immunity of Linear Re...Simplified Experimental Determination of Line Transient Immunity of Linear Re...
Simplified Experimental Determination of Line Transient Immunity of Linear Re...
NarayanlalMenariya
 
SMART E-TOLL SYSTEM
SMART E-TOLL SYSTEMSMART E-TOLL SYSTEM
SMART E-TOLL SYSTEM
NarayanlalMenariya
 
Voice From Deep Of Heart
Voice From Deep Of HeartVoice From Deep Of Heart
Voice From Deep Of Heart
NarayanlalMenariya
 
Lidar and sensing
Lidar and sensingLidar and sensing
Lidar and sensing
NarayanlalMenariya
 
A chip to protect IOT
A chip to protect IOTA chip to protect IOT
A chip to protect IOT
NarayanlalMenariya
 

More from NarayanlalMenariya (16)

Updated CV
Updated CVUpdated CV
Updated CV
 
Curriculum Vitae
Curriculum VitaeCurriculum Vitae
Curriculum Vitae
 
Face Detection And Tracking
Face Detection And TrackingFace Detection And Tracking
Face Detection And Tracking
 
Resume for fresher
Resume for fresherResume for fresher
Resume for fresher
 
C++ Programs
C++ ProgramsC++ Programs
C++ Programs
 
Character recognition
Character recognitionCharacter recognition
Character recognition
 
Steganography
SteganographySteganography
Steganography
 
client-server communication using socket IPC
client-server communication using socket IPCclient-server communication using socket IPC
client-server communication using socket IPC
 
Message queue and shared memory
Message queue and shared memoryMessage queue and shared memory
Message queue and shared memory
 
Synchronization of shared memory using semaphores
Synchronization of shared memory using semaphoresSynchronization of shared memory using semaphores
Synchronization of shared memory using semaphores
 
Home automation using MATLAB image processing
Home automation using MATLAB image processingHome automation using MATLAB image processing
Home automation using MATLAB image processing
 
Simplified Experimental Determination of Line Transient Immunity of Linear Re...
Simplified Experimental Determination of Line Transient Immunity of Linear Re...Simplified Experimental Determination of Line Transient Immunity of Linear Re...
Simplified Experimental Determination of Line Transient Immunity of Linear Re...
 
SMART E-TOLL SYSTEM
SMART E-TOLL SYSTEMSMART E-TOLL SYSTEM
SMART E-TOLL SYSTEM
 
Voice From Deep Of Heart
Voice From Deep Of HeartVoice From Deep Of Heart
Voice From Deep Of Heart
 
Lidar and sensing
Lidar and sensingLidar and sensing
Lidar and sensing
 
A chip to protect IOT
A chip to protect IOTA chip to protect IOT
A chip to protect IOT
 

Recently uploaded

FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
Elena Simperl
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Tobias Schneck
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
Cheryl Hung
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
Sri Ambati
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
Generating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using SmithyGenerating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using Smithy
g2nightmarescribd
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
Product School
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
Product School
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Jeffrey Haguewood
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
Prayukth K V
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 

Recently uploaded (20)

FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
Generating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using SmithyGenerating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using Smithy
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 

GUI based calculator using MATLAB

  • 1. Basic Calculator using GUI in MATLAB Narayan Lal Menariya ABSTRACT : A Calculator has been created by using GUI(graphical user interface) which can perform basic operations like addition , subtraction etc. GUI is created by using functions and handles for various pushbuttons and text to display the results and mathematical operations. GUI : Stands for Graphical User Interface and is pronounced "gooey." It is a user interface that includes graphical elements, such as windows, icons and buttons. In this project by using GUI we designed a basic calculator in which general operations can be perform like addition ,subtraction, multiplication etc. ALGORITHM:  Create a main function calculator  Define handles for various Pushbutton (1,2,...9,+,- ,*,/ etc) like : Zero = uicontrol(f,'style','pushbutton','string','0','pos',[20 20 110 50],... 'callback',@PushButton_zero); Here zero is a handle. Uicontrol : Create user interface control object.  Define handle for Text button
  • 2.  Call a function using handles PROGRAM: function guide_calculator() f = figure('color','r','pos',[100 100 600 400]); Zero = uicontrol(f,'style','pushbutton','string','0','pos',[20 20 110 50],... 'callback',@PushButton_zero); Dot = uicontrol(f,'style','pushbutton','string','.','pos',[140 20 50 50],... 'callback',@PushButton_dot); Equal = uicontrol(f,'style','pushbutton','string','=','pos',[200 20 50 110],... 'callback',@PushButton_equal); One = uicontrol(f,'style','pushbutton','string','1','pos',[20 80 50 50],... 'callback',@PushButton_one); Two = uicontrol(f,'style','pushbutton','string','2','pos',[80 80 50 50],... 'callback',@PushButton_two); Three = uicontrol(f,'style','pushbutton','string','3','pos',[140 80 50 50],... 'callback',@PushButton_three); Four = uicontrol(f,'style','pushbutton','string','4','pos',[20 140 50 50],... 'callback',@PushButton_four); Five = uicontrol(f,'style','pushbutton','string','5','pos',[80 140 50 50],... 'callback',@PushButton_five); Six = uicontrol(f,'style','pushbutton','string','6','pos',[140 140 50 50],... 'callback',@PushButton_six); Multiply = uicontrol(f,'style','pushbutton','string','*','pos',[200 140 50 50],... 'callback',@PushButton_multiply); Seven = uicontrol(f,'style','pushbutton','string','7','pos',[20 200 50 50],... 'callback',@PushButton_seven); Eight = uicontrol(f,'style','pushbutton','string','8','pos',[80 200 50 50],... 'callback',@PushButton_eight); Nine = uicontrol(f,'style','pushbutton','string','9','pos',[140 200 50 50],... 'callback',@PushButton_nine); Divide = uicontrol(f,'style','pushbutton','string','/','pos',[200 200 50 50],... 'callback',@PushButton_divide); Removelast = uicontrol(f,'style','pushbutton','string','<--','pos',[20 260 50 50],... 'callback',@PushButton_remove); ClearAll = uicontrol(f,'style','pushbutton','string','CE','pos',[80 260 50 50],... 'callback',@PushButton_clear);
  • 3. Minus = uicontrol(f,'style','pushbutton','string','-','pos',[140 260 50 50],... 'callback',@PushButton_minus); Plus = uicontrol(f,'style','pushbutton','string','+','pos',[200 260 50 50],... 'callback',@PushButton_plus); Text = uicontrol(f,'style','text','pos',[20 320 230 50],... 'callback',@edittext); function PushButton_zero(Zero,b) display('0') q = get(Text,'string'); set(Text,'string',strcat(q,'0')); end function PushButton_dot(Dot,b) display('.') %set(Text,'string','.') q = get(Text,'string'); set(Text,'string',strcat(q,'.')); end function PushButton_plus(Plus,b) display('+') %set(Text,'string','+') q = get(Text,'string'); set(Text,'string',strcat(q,'+')); end function PushButton_one(One,b) display('1') %set(Text,'string','1') q = get(Text,'string'); set(Text,'string',strcat(q,'1')); end function PushButton_two(Two,b) display('2') %set(Text,'string','2') q = get(Text,'string'); set(Text,'string',strcat(q,'2')); end function PushButton_three(Three,b) display('3') %set(Text,'string','3') q = get(Text,'string'); set(Text,'string',strcat(q,'3')); end function PushButton_minus(Minus,b) display('-') %set(Text,'string','-') q = get(Text,'string'); set(Text,'string',strcat(q,'-')); end
  • 4. function PushButton_four(Four,b) display('4') %set(Text,'string','4') q = get(Text,'string'); set(Text,'string',strcat(q,'4')); end function PushButton_five(Five,b) display('5') %set(Text,'string','5') q = get(Text,'string'); set(Text,'string',strcat(q,'5')); end function PushButton_six(Six,b) display('6') % set(Text,'string','6') q = get(Text,'string'); set(Text,'string',strcat(q,'6')); end function PushButton_multiply(Multiply,b) display('*') %set(Text,'string''*') q = get(Text,'string'); set(Text,'string',strcat(q,'*')); end function PushButton_seven(Seven,b) display('7') %set(Text,'string','7') q = get(Text,'string'); set(Text,'string',strcat(q,'7')); end function PushButton_eight(Eight,b) display('8') %set(Text,'string','8') q = get(Text,'string'); set(Text,'string',strcat(q,'8')); end function PushButton_nine(Nine,b) display('9') %set(Text,'string','9') q = get(Text,'string'); set(Text,'string',strcat(q,'9')); end function PushButton_divide(Divide,b) display('/') %set(Text,'string','/') q = get(Text,'string'); set(Text,'string',strcat(q,'/')); end function PushButton_clear(ClearAll,b) set(Text,'string','0');
  • 5. display(0) end function PushButton_remove(Removelast,b) q = get(Text,'string'); q1 = size(q); set(Text,'string',q(1:q1(2)-1)); end function PushButton_equal(Equal,b) a = eval(get(Text,'string')); display(a) set(Text,'string',a); size(a) end end CALCULATOR:
  • 6. CONCLUSION : In this project a basic calculator has been designed and further it can be modified as a scientific calculator and other operations can also be added.