classdef calculator_exported < matlab.apps.AppBase
% Properties that correspond to app components
properties (Access = public)
UIFigure matlab.ui.Figure
TextArea matlab.ui.control.TextArea
Button matlab.ui.control.Button
Button_2 matlab.ui.control.Button
Button_3 matlab.ui.control.Button
Button_4 matlab.ui.control.Button
Button_5 matlab.ui.control.Button
Button_6 matlab.ui.control.Button
Button_7 matlab.ui.control.Button
Button_8 matlab.ui.control.Button
Button_9 matlab.ui.control.Button
Button_10 matlab.ui.control.Button
Button_11 matlab.ui.control.Button
Button_12 matlab.ui.control.Button
Button_13 matlab.ui.control.Button
Button_14 matlab.ui.control.Button
Button_15 matlab.ui.control.Button
Button_16 matlab.ui.control.Button
Button_17 matlab.ui.control.Button
xButton matlab.ui.control.Button
Button_21 matlab.ui.control.Button
CButton matlab.ui.control.Button
Button_18 matlab.ui.control.Button
xButton_2 matlab.ui.control.Button
Button_20 matlab.ui.control.Button
end
properties (Access = private)
express_str = '' % the expression string
ans = '' % the answer
end
% Callbacks that handle component events
methods (Access = private)
% Button pushed function: Button
function Num_0Pushed(app, event)
if strcmp(app.TextArea.Value,'0')
else
app.express_str = strcat(app.express_str,'0');
app.TextArea.Value = app.express_str;
end
end
% Button pushed function: Button_3
function Num_1Pushed(app, event)
app.express_str = strcat(app.express_str,'1');
app.TextArea.Value = app.express_str;
end
% Button pushed function: Button_4
function Num_2Pushed(app, event)
app.express_str = strcat(app.express_str,'2');
app.TextArea.Value = app.express_str;
end
% Button pushed function: Button_5
function Num_3Pushed(app, event)
app.express_str = strcat(app.express_str,'3');
app.TextArea.Value = app.express_str;
end
% Button pushed function: Button_9
function Num_4Pushed(app, event)
app.express_str = strcat(app.express_str,'4');
app.TextArea.Value = app.express_str;
end
% Button pushed function: Button_8
function Num_5Pushed(app, event)
app.express_str = strcat(app.express_str,'5');
app.TextArea.Value = app.express_str;
end
% Button pushed function: Button_7
function Num_6Pushed(app, event)
app.express_str = strcat(app.express_str,'6');
app.TextArea.Value = app.express_str;
end
% Button pushed function: Button_12
function Num_7Pushed(app, event)
app.express_str = strcat(app.express_str,'7');
app.TextArea.Value = app.express_str;
end
% Button pushed function: Button_11
function Num_8Pushed(app, event)
app.express_str = strcat(app.express_str,'8');
app.TextArea.Value = app.express_str;
end
% Button pushed function: Button_10
function Num_9Pushed(app, event)
app.express_str = strcat(app.express_str,'9');
app.TextArea.Value = app.express_str;
end
% Button pushed function: Button_6
function Dot_Pushed(app, event)
app.express_str = strcat(app.express_str,'.');
app.TextArea.Value = app.express_str;
end
% Button pushed function: Button_20
function Lbracket_Pushed(app, event)
app.express_str = strcat(app.express_str,'(');
app.TextArea.Value = app.express_str;
end
% Button pushed function: Button_21
function Rbracket_Pushed(app, event)
app.express_str = strcat(app.express_str,')');
app.TextArea.Value = app.express_str;
end
% Button pushed function: xButton
function Squre_Pushed(app, event)
app.express_str = strcat(app.express_str,'^2');
app.TextArea.Value = app.express_str;
end
% Button pushed function: CButton
function Clear_Pushed(app, event)
app.express_str = '';
app.TextArea.Value = '0';
end
% Button pushed function: Button_18
function Delete_Pushed(app, event)
tail = length(app.express_str);
app.express_str = app.express_str(1,1:tail-1);
app.TextArea.Value = app.express_str;
end
% Button pushed function: Button_13
function Divide_Pushed(app, event)
app.express_str = strcat(app.express_str,'/');
app.TextArea.Value = app.express_str;
end
% Button pushed function: Button_14
function Multip_Pushed(app, event)
app.express_str = strcat(app.express_str,'*');
app.TextArea.Value = app.express_str;
end
% Button pushed function: Button_15
function Sub_Pushed(app, event)
app.express_str = strcat(app.express_str,'-');
app.TextArea.Value = app.express_str;
end
% Button pushed function: Button_16
function Add_Pushed(app, event)
app.express_str = strcat(app.express_str,'+');
app.TextArea.Value = app.express_str;
end
% Button pushed function: xButton_2
function Invert_Pushed(app, event)
if length(app.express_str)>0
try
result = eval(app.express_str);
app.ans = num2str(1/result);
app.express_str = app.ans;
app.TextArea.Value = app.ans;
catch
app.express_str = '';
app.TextArea.Value = 'error';
end
end
end
% Button pushed function: Button_17
function Pow_Pushed(app, event)
app.express_str = strcat(app.express_str,'^');
app.TextArea.Value = app.express_str;
end
% Button pushed function: Button_2
function Equal_Pushed(app, event)
if length(app.express_str)>0
try
result = eval(app.express_str);
app.ans = num2str(result);
app.express_str = app.ans;
app.TextArea.Value = app.ans;
catch
app.express_str = '';
app.TextArea.Value = 'error';
end
end
end
end
% Component initialization
methods (Access = private)
% Create UIFigure and components
function createComponents(app)
% Create UIFigure and hide until all components are created
app.UIFigure = uifigure('Visible', 'off');
app.UIFigure.Position = [100 100 357 481];
app.UIFigure.Name = 'MATLAB App';
% Create TextArea
app.TextArea = uitextarea(app.UIFigure);
app.TextArea.Tag = 'result';
app.TextArea.Editable = 'off';
app.TextArea.HorizontalAlignment = 'right';
app.TextArea.FontSize = 24;
app.TextArea.Position = [38 351 285 79];
app.TextArea.Value = {'0'};
% Create Button
app.Button = uibutton(app.UIFigure, 'push');
app.Button.ButtonPushedFcn = createCallbackFcn(app, @Num_0Pushed, true);
app.Button.Tag = '0';
app.Button.FontSize = 24;
app.Button.Position = [38 63 100 42];
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
matlab实现简易计算器的作业项目源码.zip,,含有代码注释,满分大作业资源,新手也可看懂,期末大作业、课程设计、高分必看,下载下来,简单部署,就可以使用。该项目可以作为课程设计期末大作业使用,该系统功能完善、界面美观、操作简单、功能齐全、管理便捷,具有很高的实际应用价值。 matlab实现简易计算器的作业项目源码.zipmatlab实现简易计算器的作业项目源码.zipmatlab实现简易计算器的作业项目源码.zipmatlab实现简易计算器的作业项目源码.zipmatlab实现简易计算器的作业项目源码.zipmatlab实现简易计算器的作业项目源码.zipmatlab实现简易计算器的作业项目源码.zipmatlab实现简易计算器的作业项目源码.zipmatlab实现简易计算器的作业项目源码.zipmatlab实现简易计算器的作业项目源码.zipmatlab实现简易计算器的作业项目源码.zipmatlab实现简易计算器的作业项目源码.zipmatlab实现简易计算器的作业项目源码.zipmatlab实现简易计算器的作业项目源码.zipmatlab实现简易计算器的作业项目源码.zi
资源推荐
资源详情
资源评论





























收起资源包目录




共 2 条
- 1
资源评论


yava_free
- 粉丝: 5654
- 资源: 2131

下载权益

C知道特权

VIP文章

课程特权

开通VIP
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助


最新资源
- 礼炮7号(高仿).zip
- 老八教学.pptx
- 联盟号+发射台(低仿).zip
- 龙飞船 (3).zip
- 落星二型 .zip
- 旅行者1号 .zip
- 马斯克回收火箭.zip
- 平钉弹.zip
- 平行宇宙扩展包(1).zip
- 漆黑深空号重型侦查舰 .zip
- 平坦地形.zip
- 气尖引擎.zip
- 基于MATLAB的车牌识别系统:模板匹配与GUI界面双版本详解(近两万字文档,图像处理全流程揭秘),基于MATLAB的车牌识别系统:融合模板匹配与GUI界面的综合解决方案(近两万字详解+图像处理全流程
- 曲率引擎(1.5.9.8).zip
- 20.自然语言处理2024-08-23-212720.wmv
- 微环谐振腔光学频率梳MATLAB仿真研究:考虑色散、克尔非线性与外部泵浦效应的分析和实现,微环谐振腔中的光学频率梳仿真:LLE方程求解与多种因素的考虑分析,微环谐振腔的光学频率梳matlab仿真 微腔
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈



安全验证
文档复制为VIP权益,开通VIP直接复制
