button1.show()和button1.visible=false以及button1.Hide()的区别

1、 button1.show(),button1.Hide()是方法

button1.visible是属性

2、 hide()方法可以用show()重新生成打开,占用的资源更少,但其占用的内存可以被其它程序再用。visible用true重现,一直在内存中的。button1.visible=false,隐藏 但不会释放内存 

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
% Component initialization methods (Access = private) % Create UIFigure and components function createComponents(app) % Get the file path for locating images pathToMLAPP = fileparts(mfilename('fullpath')); % Create RangeFindingUIFigure and hide until all components are created app.RangeFindingUIFigure = uifigure('Visible', 'off'); app.RangeFindingUIFigure.Position = [100 100 542 362]; app.RangeFindingUIFigure.Name = 'Range Finding'; app.RangeFindingUIFigure.Icon = fullfile(pathToMLAPP, '1251215.png'); % Create UIAxes app.UIAxes = uiaxes(app.RangeFindingUIFigure); title(app.UIAxes, '输入') zlabel(app.UIAxes, 'Z') app.UIAxes.XTick = []; app.UIAxes.XTickLabel = ''; app.UIAxes.YTick = []; app.UIAxes.ZTick = []; app.UIAxes.Position = [36 117 230 185]; % Create UIAxes_2 app.UIAxes_2 = uiaxes(app.RangeFindingUIFigure); title(app.UIAxes_2, '输出') zlabel(app.UIAxes_2, 'Z') app.UIAxes_2.XTick = []; app.UIAxes_2.XTickLabel = ''; app.UIAxes_2.YTick = []; app.UIAxes_2.ZTick = []; app.UIAxes_2.Position = [287 117 230 185]; % Create Button app.Button = uibutton(app.RangeFindingUIFigure, 'push'); app.Button.ButtonPushedFcn = createCallbackFcn(app, @ButtonPushed, true); app.Button.Position = [118 47 63 23]; app.Button.Text = '选择图像'; % Create Button_2 app.Button_2 = uibutton(app.RangeFindingUIFigure, 'push'); app.Button_2.ButtonPushedFcn = createCallbackFcn(app, @Button_2Pushed, true); app.Button_2.Position = [375 47 52 23]; app.Button_2.Text = '识别'; % Create Label app.Label = uilabel(app.RangeFindingUIFigure); app.Label.HorizontalAlignment = 'right'; app.Label.Position = [208 320 69 22]; app.Label.Text = '距离(cm)'; % Create cmEditField app.cmEditField = uieditfield(app.RangeFindingUIFigure, 'numeric'); app.cmEditField.Position = [292 320 44 22]; % Show the figure after all components are created app.RangeFindingUIFigure.Visible = 'on'; end end
最新发布
05-17

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值