classdef GalenControlApp < matlab.apps.AppBase

    % Properties that correspond to app components
    properties (Access = public)
        UIFigure                       matlab.ui.Figure
        RunTimeLengthsEditField        matlab.ui.control.NumericEditField
        RunTimeLengthsEditFieldLabel   matlab.ui.control.Label
        ExecuteRunSwitch               matlab.ui.control.RockerSwitch
        ExecuteRunSwitchLabel          matlab.ui.control.Label
        ForceControlSwitch             matlab.ui.control.Switch
        ForceControlSwitchLabel        matlab.ui.control.Label
        ImpedanceLamp                  matlab.ui.control.Lamp
        ImpedanceLampLabel             matlab.ui.control.Label
        FWyEditField                   matlab.ui.control.NumericEditField
        FWyEditFieldLabel              matlab.ui.control.Label
        FWxEditField                   matlab.ui.control.NumericEditField
        FWxEditFieldLabel              matlab.ui.control.Label
        FzEditField                    matlab.ui.control.NumericEditField
        FzEditFieldLabel               matlab.ui.control.Label
        FyEditField                    matlab.ui.control.NumericEditField
        FyEditFieldLabel               matlab.ui.control.Label
        FxEditField                    matlab.ui.control.NumericEditField
        FxEditFieldLabel               matlab.ui.control.Label
        StopAndOutputDataSwitch        matlab.ui.control.Switch
        StopAndOutputDataSwitchLabel   matlab.ui.control.Label
        ApplyImpedanceSwitch           matlab.ui.control.Switch
        ApplyImpedanceSwitchLabel      matlab.ui.control.Label
        HomeSwitch                     matlab.ui.control.Switch
        HomeSwitchLabel                matlab.ui.control.Label
        CenterSwitch                   matlab.ui.control.Switch
        CenterSwitchLabel              matlab.ui.control.Label
        DeseriedAdmittanceValuesLabel  matlab.ui.control.Label
        DeseriedImpedanceLabel         matlab.ui.control.Label
        CurrentStateVelocitiesmsorradsLabel  matlab.ui.control.Label
        WyEditField                    matlab.ui.control.NumericEditField
        WyEditFieldLabel               matlab.ui.control.Label
        WxEditField                    matlab.ui.control.NumericEditField
        WxEditFieldLabel               matlab.ui.control.Label
        ZEditField                     matlab.ui.control.NumericEditField
        ZEditFieldLabel                matlab.ui.control.Label
        YEditField                     matlab.ui.control.NumericEditField
        YEditFieldLabel                matlab.ui.control.Label
        XEditField                     matlab.ui.control.NumericEditField
        XEditFieldLabel                matlab.ui.control.Label
        Wyb_adEditField                matlab.ui.control.NumericEditField
        Wyb_adEditFieldLabel           matlab.ui.control.Label
        Wym_adEditField                matlab.ui.control.NumericEditField
        Wym_adEditFieldLabel           matlab.ui.control.Label
        Wxb_adEditField                matlab.ui.control.NumericEditField
        Wxb_adEditFieldLabel           matlab.ui.control.Label
        Wxm_adEditField                matlab.ui.control.NumericEditField
        Wxm_adEditFieldLabel           matlab.ui.control.Label
        Zb_adEditField                 matlab.ui.control.NumericEditField
        Zb_adEditFieldLabel            matlab.ui.control.Label
        Zm_adEditField                 matlab.ui.control.NumericEditField
        Zm_adEditFieldLabel            matlab.ui.control.Label
        Yb_adEditField                 matlab.ui.control.NumericEditField
        Yb_adEditFieldLabel            matlab.ui.control.Label
        Ym_adEditField                 matlab.ui.control.NumericEditField
        Ym_adEditFieldLabel            matlab.ui.control.Label
        Xb_adEditField                 matlab.ui.control.NumericEditField
        Xb_adEditFieldLabel            matlab.ui.control.Label
        Xm_adEditField                 matlab.ui.control.NumericEditField
        Xm_adEditFieldLabel            matlab.ui.control.Label
        keNmEditField                  matlab.ui.control.NumericEditField
        keNmEditFieldLabel             matlab.ui.control.Label
        khNmEditField                  matlab.ui.control.NumericEditField
        khNmEditFieldLabel             matlab.ui.control.Label
        bhNsmEditField                 matlab.ui.control.NumericEditField
        bhNsmEditFieldLabel            matlab.ui.control.Label
        mhkgEditField                  matlab.ui.control.NumericEditField
        mhkgEditFieldLabel             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.Position = [100 100 667 474];
            app.UIFigure.Name = 'MATLAB App';

            % Create mhkgEditFieldLabel
            app.mhkgEditFieldLabel = uilabel(app.UIFigure);
            app.mhkgEditFieldLabel.HorizontalAlignment = 'right';
            app.mhkgEditFieldLabel.Position = [193 399 46 22];
            app.mhkgEditFieldLabel.Text = 'mh (kg)';

            % Create mhkgEditField
            app.mhkgEditField = uieditfield(app.UIFigure, 'numeric');
            app.mhkgEditField.Limits = [0 5];
            app.mhkgEditField.Position = [254 399 100 22];

            % Create bhNsmEditFieldLabel
            app.bhNsmEditFieldLabel = uilabel(app.UIFigure);
            app.bhNsmEditFieldLabel.HorizontalAlignment = 'right';
            app.bhNsmEditFieldLabel.Position = [181 364 58 22];
            app.bhNsmEditFieldLabel.Text = 'bh (Ns/m)';

            % Create bhNsmEditField
            app.bhNsmEditField = uieditfield(app.UIFigure, 'numeric');
            app.bhNsmEditField.Limits = [0 41];
            app.bhNsmEditField.Position = [254 364 100 22];

            % Create khNmEditFieldLabel
            app.khNmEditFieldLabel = uilabel(app.UIFigure);
            app.khNmEditFieldLabel.HorizontalAlignment = 'right';
            app.khNmEditFieldLabel.Position = [188 325 51 22];
            app.khNmEditFieldLabel.Text = 'kh (N/m)';

            % Create khNmEditField
            app.khNmEditField = uieditfield(app.UIFigure, 'numeric');
            app.khNmEditField.Limits = [0 401];
            app.khNmEditField.Position = [254 325 100 22];
            app.khNmEditField.Value = 401;

            % Create keNmEditFieldLabel
            app.keNmEditFieldLabel = uilabel(app.UIFigure);
            app.keNmEditFieldLabel.HorizontalAlignment = 'right';
            app.keNmEditFieldLabel.Position = [187 286 51 22];
            app.keNmEditFieldLabel.Text = 'ke (N/m)';

            % Create keNmEditField
            app.keNmEditField = uieditfield(app.UIFigure, 'numeric');
            app.keNmEditField.Limits = [0 16599];
            app.keNmEditField.Position = [253 286 100 22];

            % Create Xm_adEditFieldLabel
            app.Xm_adEditFieldLabel = uilabel(app.UIFigure);
            app.Xm_adEditFieldLabel.HorizontalAlignment = 'right';
            app.Xm_adEditFieldLabel.Position = [48 150 46 22];
            app.Xm_adEditFieldLabel.Text = 'X m_ad';

            % Create Xm_adEditField
            app.Xm_adEditField = uieditfield(app.UIFigure, 'numeric');
            app.Xm_adEditField.Position = [109 150 38 22];
            app.Xm_adEditField.Value = 20;

            % Create Xb_adEditFieldLabel
            app.Xb_adEditFieldLabel = uilabel(app.UIFigure);
            app.Xb_adEditFieldLabel.HorizontalAlignment = 'right';
            app.Xb_adEditFieldLabel.Position = [51 112 43 22];
            app.Xb_adEditFieldLabel.Text = 'X b_ad';

            % Create Xb_adEditField
            app.Xb_adEditField = uieditfield(app.UIFigure, 'numeric');
            app.Xb_adEditField.Position = [109 112 38 22];
            app.Xb_adEditField.Value = 150;

            % Create Ym_adEditFieldLabel
            app.Ym_adEditFieldLabel = uilabel(app.UIFigure);
            app.Ym_adEditFieldLabel.HorizontalAlignment = 'right';
            app.Ym_adEditFieldLabel.Position = [156 150 46 22];
            app.Ym_adEditFieldLabel.Text = 'Y m_ad';

            % Create Ym_adEditField
            app.Ym_adEditField = uieditfield(app.UIFigure, 'numeric');
            app.Ym_adEditField.Position = [217 150 38 22];
            app.Ym_adEditField.Value = 20;

            % Create Yb_adEditFieldLabel
            app.Yb_adEditFieldLabel = uilabel(app.UIFigure);
            app.Yb_adEditFieldLabel.HorizontalAlignment = 'right';
            app.Yb_adEditFieldLabel.Position = [156 112 43 22];
            app.Yb_adEditFieldLabel.Text = 'Y b_ad';

            % Create Yb_adEditField
            app.Yb_adEditField = uieditfield(app.UIFigure, 'numeric');
            app.Yb_adEditField.Position = [214 112 40 22];
            app.Yb_adEditField.Value = 170;

            % Create Zm_adEditFieldLabel
            app.Zm_adEditFieldLabel = uilabel(app.UIFigure);
            app.Zm_adEditFieldLabel.HorizontalAlignment = 'right';
            app.Zm_adEditFieldLabel.Position = [270 150 46 22];
            app.Zm_adEditFieldLabel.Text = 'Z m_ad';

            % Create Zm_adEditField
            app.Zm_adEditField = uieditfield(app.UIFigure, 'numeric');
            app.Zm_adEditField.Position = [331 150 38 22];
            app.Zm_adEditField.Value = 20;

            % Create Zb_adEditFieldLabel
            app.Zb_adEditFieldLabel = uilabel(app.UIFigure);
            app.Zb_adEditFieldLabel.HorizontalAlignment = 'right';
            app.Zb_adEditFieldLabel.Position = [271 112 42 22];
            app.Zb_adEditFieldLabel.Text = 'Z b_ad';

            % Create Zb_adEditField
            app.Zb_adEditField = uieditfield(app.UIFigure, 'numeric');
            app.Zb_adEditField.Position = [328 112 40 22];
            app.Zb_adEditField.Value = 170;

            % Create Wxm_adEditFieldLabel
            app.Wxm_adEditFieldLabel = uilabel(app.UIFigure);
            app.Wxm_adEditFieldLabel.HorizontalAlignment = 'right';
            app.Wxm_adEditFieldLabel.Position = [370 150 56 22];
            app.Wxm_adEditFieldLabel.Text = 'Wx m_ad';

            % Create Wxm_adEditField
            app.Wxm_adEditField = uieditfield(app.UIFigure, 'numeric');
            app.Wxm_adEditField.Position = [441 150 38 22];
            app.Wxm_adEditField.Value = 20;

            % Create Wxb_adEditFieldLabel
            app.Wxb_adEditFieldLabel = uilabel(app.UIFigure);
            app.Wxb_adEditFieldLabel.HorizontalAlignment = 'right';
            app.Wxb_adEditFieldLabel.Position = [372 112 52 22];
            app.Wxb_adEditFieldLabel.Text = 'Wx b_ad';

            % Create Wxb_adEditField
            app.Wxb_adEditField = uieditfield(app.UIFigure, 'numeric');
            app.Wxb_adEditField.Position = [439 112 40 22];
            app.Wxb_adEditField.Value = 170;

            % Create Wym_adEditFieldLabel
            app.Wym_adEditFieldLabel = uilabel(app.UIFigure);
            app.Wym_adEditFieldLabel.HorizontalAlignment = 'right';
            app.Wym_adEditFieldLabel.Position = [478 150 56 22];
            app.Wym_adEditFieldLabel.Text = 'Wy m_ad';

            % Create Wym_adEditField
            app.Wym_adEditField = uieditfield(app.UIFigure, 'numeric');
            app.Wym_adEditField.Position = [549 150 38 22];
            app.Wym_adEditField.Value = 20;

            % Create Wyb_adEditFieldLabel
            app.Wyb_adEditFieldLabel = uilabel(app.UIFigure);
            app.Wyb_adEditFieldLabel.HorizontalAlignment = 'right';
            app.Wyb_adEditFieldLabel.Position = [480 112 52 22];
            app.Wyb_adEditFieldLabel.Text = 'Wy b_ad';

            % Create Wyb_adEditField
            app.Wyb_adEditField = uieditfield(app.UIFigure, 'numeric');
            app.Wyb_adEditField.Position = [547 112 40 22];
            app.Wyb_adEditField.Value = 270;

            % Create XEditFieldLabel
            app.XEditFieldLabel = uilabel(app.UIFigure);
            app.XEditFieldLabel.HorizontalAlignment = 'right';
            app.XEditFieldLabel.Position = [386 399 25 22];
            app.XEditFieldLabel.Text = 'X';

            % Create XEditField
            app.XEditField = uieditfield(app.UIFigure, 'numeric');
            app.XEditField.Editable = 'off';
            app.XEditField.Position = [426 399 62 22];

            % Create YEditFieldLabel
            app.YEditFieldLabel = uilabel(app.UIFigure);
            app.YEditFieldLabel.HorizontalAlignment = 'right';
            app.YEditFieldLabel.Position = [386 364 25 22];
            app.YEditFieldLabel.Text = 'Y';

            % Create YEditField
            app.YEditField = uieditfield(app.UIFigure, 'numeric');
            app.YEditField.Editable = 'off';
            app.YEditField.Position = [426 364 62 22];

            % Create ZEditFieldLabel
            app.ZEditFieldLabel = uilabel(app.UIFigure);
            app.ZEditFieldLabel.HorizontalAlignment = 'right';
            app.ZEditFieldLabel.Position = [386 325 25 22];
            app.ZEditFieldLabel.Text = 'Z';

            % Create ZEditField
            app.ZEditField = uieditfield(app.UIFigure, 'numeric');
            app.ZEditField.Editable = 'off';
            app.ZEditField.Position = [426 325 62 22];

            % Create WxEditFieldLabel
            app.WxEditFieldLabel = uilabel(app.UIFigure);
            app.WxEditFieldLabel.HorizontalAlignment = 'right';
            app.WxEditFieldLabel.Position = [386 286 25 22];
            app.WxEditFieldLabel.Text = 'Wx';

            % Create WxEditField
            app.WxEditField = uieditfield(app.UIFigure, 'numeric');
            app.WxEditField.Editable = 'off';
            app.WxEditField.Position = [426 286 62 22];

            % Create WyEditFieldLabel
            app.WyEditFieldLabel = uilabel(app.UIFigure);
            app.WyEditFieldLabel.HorizontalAlignment = 'right';
            app.WyEditFieldLabel.Position = [386 242 25 22];
            app.WyEditFieldLabel.Text = 'Wy';

            % Create WyEditField
            app.WyEditField = uieditfield(app.UIFigure, 'numeric');
            app.WyEditField.Editable = 'off';
            app.WyEditField.Position = [426 242 62 22];

            % Create CurrentStateVelocitiesmsorradsLabel
            app.CurrentStateVelocitiesmsorradsLabel = uilabel(app.UIFigure);
            app.CurrentStateVelocitiesmsorradsLabel.Position = [392 420 130 30];
            app.CurrentStateVelocitiesmsorradsLabel.Text = {'Current State Velocities'; ' m/s or rad/s'};

            % Create DeseriedImpedanceLabel
            app.DeseriedImpedanceLabel = uilabel(app.UIFigure);
            app.DeseriedImpedanceLabel.Position = [243 428 116 22];
            app.DeseriedImpedanceLabel.Text = 'Deseried Impedance';

            % Create DeseriedAdmittanceValuesLabel
            app.DeseriedAdmittanceValuesLabel = uilabel(app.UIFigure);
            app.DeseriedAdmittanceValuesLabel.Position = [51 171 158 22];
            app.DeseriedAdmittanceValuesLabel.Text = 'Deseried Admittance Values:';

            % Create CenterSwitchLabel
            app.CenterSwitchLabel = uilabel(app.UIFigure);
            app.CenterSwitchLabel.HorizontalAlignment = 'center';
            app.CenterSwitchLabel.Position = [91 347 41 22];
            app.CenterSwitchLabel.Text = 'Center';

            % Create CenterSwitch
            app.CenterSwitch = uiswitch(app.UIFigure, 'slider');
            app.CenterSwitch.Position = [88 384 45 20];

            % Create HomeSwitchLabel
            app.HomeSwitchLabel = uilabel(app.UIFigure);
            app.HomeSwitchLabel.HorizontalAlignment = 'center';
            app.HomeSwitchLabel.Position = [93 269 37 22];
            app.HomeSwitchLabel.Text = 'Home';

            % Create HomeSwitch
            app.HomeSwitch = uiswitch(app.UIFigure, 'slider');
            app.HomeSwitch.Position = [88 306 45 20];

            % Create ApplyImpedanceSwitchLabel
            app.ApplyImpedanceSwitchLabel = uilabel(app.UIFigure);
            app.ApplyImpedanceSwitchLabel.HorizontalAlignment = 'center';
            app.ApplyImpedanceSwitchLabel.Position = [61 196 98 22];
            app.ApplyImpedanceSwitchLabel.Text = 'Apply Impedance';

            % Create ApplyImpedanceSwitch
            app.ApplyImpedanceSwitch = uiswitch(app.UIFigure, 'slider');
            app.ApplyImpedanceSwitch.Position = [87 233 45 20];

            % Create StopAndOutputDataSwitchLabel
            app.StopAndOutputDataSwitchLabel = uilabel(app.UIFigure);
            app.StopAndOutputDataSwitchLabel.HorizontalAlignment = 'center';
            app.StopAndOutputDataSwitchLabel.Position = [193 196 122 22];
            app.StopAndOutputDataSwitchLabel.Text = 'Stop And Output Data';

            % Create StopAndOutputDataSwitch
            app.StopAndOutputDataSwitch = uiswitch(app.UIFigure, 'slider');
            app.StopAndOutputDataSwitch.Position = [231 233 45 20];

            % Create FxEditFieldLabel
            app.FxEditFieldLabel = uilabel(app.UIFigure);
            app.FxEditFieldLabel.HorizontalAlignment = 'right';
            app.FxEditFieldLabel.Position = [46 33 25 22];
            app.FxEditFieldLabel.Text = 'Fx';

            % Create FxEditField
            app.FxEditField = uieditfield(app.UIFigure, 'numeric');
            app.FxEditField.Position = [86 33 62 22];

            % Create FyEditFieldLabel
            app.FyEditFieldLabel = uilabel(app.UIFigure);
            app.FyEditFieldLabel.HorizontalAlignment = 'right';
            app.FyEditFieldLabel.Position = [158 33 25 22];
            app.FyEditFieldLabel.Text = 'Fy';

            % Create FyEditField
            app.FyEditField = uieditfield(app.UIFigure, 'numeric');
            app.FyEditField.Position = [198 33 62 22];

            % Create FzEditFieldLabel
            app.FzEditFieldLabel = uilabel(app.UIFigure);
            app.FzEditFieldLabel.HorizontalAlignment = 'right';
            app.FzEditFieldLabel.Position = [268 33 25 22];
            app.FzEditFieldLabel.Text = 'Fz';

            % Create FzEditField
            app.FzEditField = uieditfield(app.UIFigure, 'numeric');
            app.FzEditField.Position = [308 33 62 22];

            % Create FWxEditFieldLabel
            app.FWxEditFieldLabel = uilabel(app.UIFigure);
            app.FWxEditFieldLabel.HorizontalAlignment = 'right';
            app.FWxEditFieldLabel.Position = [371 33 30 22];
            app.FWxEditFieldLabel.Text = 'FWx';

            % Create FWxEditField
            app.FWxEditField = uieditfield(app.UIFigure, 'numeric');
            app.FWxEditField.Position = [416 33 62 22];

            % Create FWyEditFieldLabel
            app.FWyEditFieldLabel = uilabel(app.UIFigure);
            app.FWyEditFieldLabel.HorizontalAlignment = 'right';
            app.FWyEditFieldLabel.Position = [481 33 30 22];
            app.FWyEditFieldLabel.Text = 'FWy';

            % Create FWyEditField
            app.FWyEditField = uieditfield(app.UIFigure, 'numeric');
            app.FWyEditField.Position = [526 33 62 22];

            % Create ImpedanceLampLabel
            app.ImpedanceLampLabel = uilabel(app.UIFigure);
            app.ImpedanceLampLabel.HorizontalAlignment = 'right';
            app.ImpedanceLampLabel.Position = [32 428 64 22];
            app.ImpedanceLampLabel.Text = 'Impedance';

            % Create ImpedanceLamp
            app.ImpedanceLamp = uilamp(app.UIFigure);
            app.ImpedanceLamp.Position = [111 428 20 20];

            % Create ForceControlSwitchLabel
            app.ForceControlSwitchLabel = uilabel(app.UIFigure);
            app.ForceControlSwitchLabel.HorizontalAlignment = 'center';
            app.ForceControlSwitchLabel.Position = [289 91 74 22];
            app.ForceControlSwitchLabel.Text = 'ForceControl';

            % Create ForceControlSwitch
            app.ForceControlSwitch = uiswitch(app.UIFigure, 'slider');
            app.ForceControlSwitch.Items = {'Assign force by Gamepad', 'Assign force by Direct Number Input'};
            app.ForceControlSwitch.Position = [303 72 45 20];
            app.ForceControlSwitch.Value = 'Assign force by Gamepad';

            % Create ExecuteRunSwitchLabel
            app.ExecuteRunSwitchLabel = uilabel(app.UIFigure);
            app.ExecuteRunSwitchLabel.HorizontalAlignment = 'center';
            app.ExecuteRunSwitchLabel.Position = [582 305 74 22];
            app.ExecuteRunSwitchLabel.Text = 'Execute Run';

            % Create ExecuteRunSwitch
            app.ExecuteRunSwitch = uiswitch(app.UIFigure, 'rocker');
            app.ExecuteRunSwitch.Items = {'Off', 'Go'};
            app.ExecuteRunSwitch.Position = [609 239 20 45];

            % Create RunTimeLengthsEditFieldLabel
            app.RunTimeLengthsEditFieldLabel = uilabel(app.UIFigure);
            app.RunTimeLengthsEditFieldLabel.HorizontalAlignment = 'right';
            app.RunTimeLengthsEditFieldLabel.Position = [527 326 62 30];
            app.RunTimeLengthsEditFieldLabel.Text = {'Run Time'; ' Length (s)'};

            % Create RunTimeLengthsEditField
            app.RunTimeLengthsEditField = uieditfield(app.UIFigure, 'numeric');
            app.RunTimeLengthsEditField.Position = [604 334 38 22];
            app.RunTimeLengthsEditField.Value = 10;

            % 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 = GalenControlApp

            % Create UIFigure and components
            createComponents(app)

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

            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