养了一只洋 2021-03-31 11:36 采纳率: 100%
浏览 1384
已采纳

MATLAB 做的一个app界面,如何输入数据,进行运算。

用matlab的app编辑功能简单做了一个界面,但是不知道输入的这些数据框怎么用

再代码里面要怎么对他们赋值、公式计算、输出

求大神解答

感谢!

classdef app1 < matlab.apps.AppBase

    % Properties that correspond to app components
    properties (Access = public)
        UIFigure     matlab.ui.Figure
        Menu         matlab.ui.container.Menu
        Menu_3       matlab.ui.container.Menu
        Menu_4       matlab.ui.container.Menu
        GridLayout   matlab.ui.container.GridLayout
        EditField    matlab.ui.control.NumericEditField
        EditField_2  matlab.ui.control.NumericEditField
        Slider       matlab.ui.control.Slider
        Label_6      matlab.ui.control.Label
        ListBox      matlab.ui.control.ListBox
        Label_7      matlab.ui.control.Label
        ListBox_2    matlab.ui.control.ListBox
        Label_8      matlab.ui.control.Label
        ListBox_3    matlab.ui.control.ListBox
        Label_9      matlab.ui.control.Label
        ListBox_4    matlab.ui.control.ListBox
        Label_10     matlab.ui.control.Label
        EditField_3  matlab.ui.control.NumericEditField
        Label_11     matlab.ui.control.Label
        Label_12     matlab.ui.control.Label
        cmLabel      matlab.ui.control.Label
        HzLabel      matlab.ui.control.Label
        cm2Label     matlab.ui.control.Label
        EditField_8  matlab.ui.control.NumericEditField
        EditField_7  matlab.ui.control.NumericEditField
        EditField_6  matlab.ui.control.NumericEditField
        EditField_5  matlab.ui.control.NumericEditField
        EditField_4  matlab.ui.control.NumericEditField
        Wcm2Label    matlab.ui.control.Label
    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.Color = [0.9412 0.9412 0.9412];
            app.UIFigure.Position = [100 100 719 543];
            app.UIFigure.Name = 'UI Figure';

            % Create Menu
            app.Menu = uimenu(app.UIFigure);
            app.Menu.Text = '目标类型';

            % Create Menu_3
            app.Menu_3 = uimenu(app.Menu);
            app.Menu_3.Text = '点目标';

            % Create Menu_4
            app.Menu_4 = uimenu(app.Menu);
            app.Menu_4.Text = '扩展源目标';

            % Create GridLayout
            app.GridLayout = uigridlayout(app.UIFigure);
            app.GridLayout.ColumnWidth = {'1x', 77, '4x', '2.72x', '4x', 'fit', '11.16x'};
            app.GridLayout.RowHeight = {'3.03x', 22, '1x', '1x', '1x', '1x', '1x', '1.1x', 24, '1x', 24, '1x', 24, 39, '3.23x'};

            % Create EditField 大气透过率
            app.EditField = uieditfield(app.GridLayout, 'numeric');
            app.EditField.Layout.Row = 9;
            app.EditField.Layout.Column = 5;

            % Create EditField_2 目标辐射特性
            app.EditField_2 = uieditfield(app.GridLayout, 'numeric');
            app.EditField_2.Layout.Row = 11;
            app.EditField_2.Layout.Column = 5;

            % Create Slider 信号处理损失等因素系数(滑块)
            app.Slider = uislider(app.GridLayout);
            app.Slider.Limits = [3 4];
            app.Slider.Layout.Row = 14;
            app.Slider.Layout.Column = [3 4];
            app.Slider.Value = 3;

            % Create Label_6 红外系统参数
            app.Label_6 = uilabel(app.GridLayout);
            app.Label_6.HorizontalAlignment = 'center';
            app.Label_6.FontWeight = 'bold';
            app.Label_6.Layout.Row = 2;
            app.Label_6.Layout.Column = 2;
            app.Label_6.Text = '红外系统参数';

            % Create ListBox
            app.ListBox = uilistbox(app.GridLayout);
            app.ListBox.Items = {'光学系统入射孔径直径', '红外探测器比探测度', '光学系统透过率', '等效噪声带宽', '信噪比', '红外探测器敏感元面积', ''};
            app.ListBox.Layout.Row = [2 7];
            app.ListBox.Layout.Column = [3 4];
            app.ListBox.Value = '光学系统入射孔径直径';

            % Create Label_7 大气透过率
            app.Label_7 = uilabel(app.GridLayout);
            app.Label_7.HorizontalAlignment = 'right';
            app.Label_7.FontWeight = 'bold';
            app.Label_7.Layout.Row = 9;
            app.Label_7.Layout.Column = 2;
            app.Label_7.Text = '大气透过率   ';

            % Create ListBox_2
            app.ListBox_2 = uilistbox(app.GridLayout);
            app.ListBox_2.Items = {'大气透过率'};
            app.ListBox_2.Layout.Row = 9;
            app.ListBox_2.Layout.Column = 3;
            app.ListBox_2.Value = '大气透过率';

            % Create Label_8 目标辐射特性
            app.Label_8 = uilabel(app.GridLayout);
            app.Label_8.HorizontalAlignment = 'center';
            app.Label_8.FontWeight = 'bold';
            app.Label_8.Layout.Row = 11;
            app.Label_8.Layout.Column = 2;
            app.Label_8.Text = '目标辐射特性';

            % Create ListBox_3
            app.ListBox_3 = uilistbox(app.GridLayout);
            app.ListBox_3.Items = {'红外辐射强度(W/cm^2)'};
            app.ListBox_3.Layout.Row = 11;
            app.ListBox_3.Layout.Column = [3 4];
            app.ListBox_3.Value = '红外辐射强度(W/cm^2)';

            % Create Label_9 其他
            app.Label_9 = uilabel(app.GridLayout);
            app.Label_9.HorizontalAlignment = 'center';
            app.Label_9.FontWeight = 'bold';
            app.Label_9.Layout.Row = 13;
            app.Label_9.Layout.Column = 2;
            app.Label_9.Text = '其他';

            % Create ListBox_4
            app.ListBox_4 = uilistbox(app.GridLayout);
            app.ListBox_4.Items = {'信号处理损失等因素系数'};
            app.ListBox_4.Layout.Row = 13;
            app.ListBox_4.Layout.Column = [3 4];
            app.ListBox_4.Value = '信号处理损失等因素系数';

            % Create Label_10
            app.Label_10 = uilabel(app.GridLayout);
            app.Label_10.HorizontalAlignment = 'center';
            app.Label_10.FontSize = 25;
            app.Label_10.FontWeight = 'bold';
            app.Label_10.Layout.Row = 1;
            app.Label_10.Layout.Column = 2;
            app.Label_10.Text = '参数';

            % Create EditField_3 光学系统入射孔径直径
            app.EditField_3 = uieditfield(app.GridLayout, 'numeric');
            app.EditField_3.ValueChangedFcn = createCallbackFcn(app, @EditField_3ValueChanged, true);
            app.EditField_3.Interruptible = 'off';
            app.EditField_3.Layout.Row = 2;
            app.EditField_3.Layout.Column = 5;

            % Create Label_11
            app.Label_11 = uilabel(app.GridLayout);
            app.Label_11.HorizontalAlignment = 'center';
            app.Label_11.FontSize = 25;
            app.Label_11.FontWeight = 'bold';
            app.Label_11.Layout.Row = [2 4];
            app.Label_11.Layout.Column = 7;
            app.Label_11.Text = '点目标作用距离';

            % Create Label_12
            app.Label_12 = uilabel(app.GridLayout);
            app.Label_12.HorizontalAlignment = 'center';
            app.Label_12.FontSize = 25;
            app.Label_12.FontWeight = 'bold';
            app.Label_12.Layout.Row = [9 11];
            app.Label_12.Layout.Column = 7;
            app.Label_12.Text = '扩展源目标作用距离';

            % Create EditField_4 红外探测器比探测度
            app.EditField_4 = uieditfield(app.GridLayout, 'numeric');
            app.EditField_4.Layout.Row = 3;
            app.EditField_4.Layout.Column = 5;

            % Create EditField_5 光学系统透过率
            app.EditField_5 = uieditfield(app.GridLayout, 'numeric');
            app.EditField_5.Layout.Row = 4;
            app.EditField_5.Layout.Column = 5;

            % Create EditField_6 等效噪声带宽
            app.EditField_6 = uieditfield(app.GridLayout, 'numeric');
            app.EditField_6.Layout.Row = 5;
            app.EditField_6.Layout.Column = 5;

            % Create EditField_7 信噪比
            app.EditField_7 = uieditfield(app.GridLayout, 'numeric');
            app.EditField_7.Layout.Row = 6;
            app.EditField_7.Layout.Column = 5;

            % Create EditField_8 红外探测器敏感元面积
            app.EditField_8 = uieditfield(app.GridLayout, 'numeric');
            app.EditField_8.Layout.Row = 7;
            app.EditField_8.Layout.Column = 5;

            % Create cmLabel 单位
            app.cmLabel = uilabel(app.GridLayout);
            app.cmLabel.HorizontalAlignment = 'center';
            app.cmLabel.Layout.Row = 2;
            app.cmLabel.Layout.Column = 6;
            app.cmLabel.Text = 'cm';

            % Create HzLabel 单位
            app.HzLabel = uilabel(app.GridLayout);
            app.HzLabel.HorizontalAlignment = 'center';
            app.HzLabel.Layout.Row = 5;
            app.HzLabel.Layout.Column = 6;
            app.HzLabel.Text = 'Hz';

            % Create cm2Label 单位
            app.cm2Label = uilabel(app.GridLayout);
            app.cm2Label.HorizontalAlignment = 'center';
            app.cm2Label.Layout.Row = 7;
            app.cm2Label.Layout.Column = 6;
            app.cm2Label.Text = 'cm^2';

            % Create Wcm2Label 单位
            app.Wcm2Label = uilabel(app.GridLayout);
            app.Wcm2Label.HorizontalAlignment = 'center';
            app.Wcm2Label.Layout.Row = 11;
            app.Wcm2Label.Layout.Column = 6;
            app.Wcm2Label.Text = 'W/cm^2';

            % Show the figure after all components are created
            app.UIFigure.Visible = 'on';
        end
    end

    % App creation and deletion
    methods (Access = public)

        % Construct app
        function app = app1(varargin)

            % Create UIFigure and components
            createComponents(app)

            % Register the app with App Designer
            registerApp(app, app.UIFigure)

            % Execute the startup function
            runStartupFcn(app, @(app)startupFcn(app, varargin{:}))

            if nargout == 0
                clear app
            end
        end

        % Code that executes before app deletion
        function delete(app)

            % Delete UIFigure when app is deleted
            delete(app.UIFigure)
        end
    end
end
  • 写回答

1条回答 默认 最新

  • CSDN专家-孙老师 2021-04-02 18:52
    关注

    需要给每一个控件编写回调函数,也就是callback函数,在控件上,右击鼠标,查看回调,编写回调函数。

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 wireshark抓不到vlan
  • ¥20 关于#stm32#的问题:需要指导自动酸碱滴定仪的原理图程序代码及仿真
  • ¥20 设计一款异域新娘的视频相亲软件需要哪些技术支持
  • ¥15 stata安慰剂检验作图但是真实值不出现在图上
  • ¥15 c程序不知道为什么得不到结果
  • ¥40 复杂的限制性的商函数处理
  • ¥15 程序不包含适用于入口点的静态Main方法
  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来