SNS Lab#08
SNS Lab#08
SNS Lab#08
190319
BEEE-4B
EXPERIMENT # 08
Introduction to MATLAB GUI
Objective:
Lab Task:
1. Design a simple calculator using MATLAB GUI that can add, subtract, multiply
and divide two numbers and displays the result.
Code:
Here, I have paste the whole code because code is too long to be pasted as snaps here, so
I copy paste it here from matlab.
if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT
% --- Outputs from this function are returned to the command line.
function varargout = untitled_OutputFcn(hObject, eventdata, handles)
% varargout cell 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)
if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT
% --- Outputs from this function are returned to the command line.
function varargout = TASK_2_OutputFcn(hObject, eventdata, handles)
% varargout cell 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)
Output:
• NATURAL LOG
• x10
• SQUARE ROOT
• SQUARE
• FACTORIAL
• Exp
• SINE
• COSINE
• TANGENT
Conclusion:
In this lab we learned about Matlab guide(GUI development environment) and
also learned about how to design calculator on matlab.