0% found this document useful (0 votes)
117 views30 pages

GUI Calculator PDF

The document describes how to design a graphical user interface (GUI) calculator in MATLAB. It provides the configuration details for each button on the calculator, including the button text, font, and tag in the property inspector. It also provides the callback code for each button to add text to the display or evaluate the calculation when the equal button is pressed. The goal is to design the GUI calculator to match the example image provided.

Uploaded by

Ardrick Bosco
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
117 views30 pages

GUI Calculator PDF

The document describes how to design a graphical user interface (GUI) calculator in MATLAB. It provides the configuration details for each button on the calculator, including the button text, font, and tag in the property inspector. It also provides the callback code for each button to add text to the display or evaluate the calculation when the equal button is pressed. The goal is to design the GUI calculator to match the example image provided.

Uploaded by

Ardrick Bosco
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 30

Graphical User

Interface (GUI)














Make the following
changes in the panel
property inspector
Make the following
changes in the static text
property inspector
Let us make respective
changes to design a
calculator like the one in
the image.
Property Inspector
configuration of '0'
button
Property Inspector configuration of '0' button
string = 0
font = 12
tag = ZERO

Callback of '0' button in calculator


OLDstring=get(handles.text1,'string');
NEWstring=(‘0’);
textstring=strcat(OLDstring,NEWstring);
set(handles.text1,'string',textstring);
Property Inspector configuration of '1' button
string = 1
font = 12
tag = ONE

Callback of '1' button in calculator


OLDstring=get(handles.text1,'string');
NEWstring=(‘1’);
textstring=strcat(OLDstring,NEWstring);
set(handles.text1,'string',textstring);
Property Inspector configuration of '2' button
string = 2
font = 12
tag = TWO

Callback of '2' button in calculator


OLDstring=get(handles.text1,'string');
NEWstring=(‘2’);
textstring=strcat(OLDstring,NEWstring);
set(handles.text1,'string',textstring);
Property Inspector configuration of '3' button
string = 3
font = 12
tag = THREE

Callback of '3' button in calculator


OLDstring=get(handles.text1,'string');
NEWstring=(‘3’);
textstring=strcat(OLDstring,NEWstring);
set(handles.text1,'string',textstring);
Property Inspector configuration of '4' button
string = 4
font = 12
tag = FOUR

Callback of '4' button in calculator


OLDstring=get(handles.text1,'string');
NEWstring=(‘4’);
textstring=strcat(OLDstring,NEWstring);
set(handles.text1,'string',textstring);
Property Inspector configuration of '5' button
string = 5
font = 12
tag = FIVE

Callback of '5' button in calculator


OLDstring=get(handles.text1,'string');
NEWstring=(‘5’);
textstring=strcat(OLDstring,NEWstring);
set(handles.text1,'string',textstring);
Property Inspector configuration of '6' button
string = 6
font = 12
tag = SIX

Callback of '6' button in calculator


OLDstring=get(handles.text1,'string');
NEWstring=(‘6’);
textstring=strcat(OLDstring,NEWstring);
set(handles.text1,'string',textstring);
Property Inspector configuration of '7' button
string = 7
font = 12
tag = SEVEN

Callback of '7' button in calculator


OLDstring=get(handles.text1,'string');
NEWstring=(‘7’);
textstring=strcat(OLDstring,NEWstring);
set(handles.text1,'string',textstring);
Property Inspector configuration of '8' button
string = 8
font = 12
tag = EIGHT

Callback of '8' button in calculator


OLDstring=get(handles.text1,'string');
NEWstring=(‘8’);
textstring=strcat(OLDstring,NEWstring);
set(handles.text1,'string',textstring);
Property Inspector configuration of '9' button
string = 9
font = 12
tag = NINE

Callback of '9' button in calculator


OLDstring=get(handles.text1,'string');
NEWstring=(‘9’);
textstring=strcat(OLDstring,NEWstring);
set(handles.text1,'string',textstring);
Property Inspector configuration of '+' button
string = +
font = 12
tag = PLUS

Callback of '+' button in calculator


OLDstring=get(handles.text1,'string');
NEWstring=(‘+’);
textstring=strcat(OLDstring,NEWstring);
set(handles.text1,'string',textstring);
Property Inspector configuration of '-' button
string = -
font = 12
tag = MINUS

Callback of '-' button in calculator


OLDstring=get(handles.text1,'string');
NEWstring=(‘-’);
textstring=strcat(OLDstring,NEWstring);
set(handles.text1,'string',textstring);
Property Inspector configuration of '*' button
string = *
font = 12
tag = MULTIPLY

Callback of '*' button in calculator


OLDstring=get(handles.text1,'string');
NEWstring=(‘*’);
textstring=strcat(OLDstring,NEWstring);
set(handles.text1,'string',textstring);
Property Inspector configuration of '/' button
string = /
font = 12
tag = DIVIDE

Callback of '/' button in calculator


OLDstring=get(handles.text1,'string');
NEWstring=(‘/’);
textstring=strcat(OLDstring,NEWstring);
set(handles.text1,'string',textstring);
Property Inspector configuration of 'pi' button
string = pi
font = 12
tag = pivalue

Callback of 'pi' button in calculator


OLDstring=get(handles.text1,'string');
NEWstring=(‘pi’);
textstring=strcat(OLDstring,NEWstring);
set(handles.text1,'string',textstring);
Property Inspector configuration of '^' button
string = ^
font = 12
tag = expo

Callback of '^' button in calculator


OLDstring=get(handles.text1,'string');
NEWstring=(‘^’);
textstring=strcat(OLDstring,NEWstring);
set(handles.text1,'string',textstring);
Property Inspector configuration of 'clr' button
string = CLR
font = 12
tag = CLEAR

Callback of 'clr' button in calculator


set(handles.text1,'string',' ');
Property Inspector configuration of '=' button
string = =
font = 12
tag = equal

Callback of '=' button in calculator


textstring=get(handles.text1,'string');
textstring=eval(textstring);
set(handles.text1,'string',textstring);

You might also like