How to create matlab.apps.AppBase

How to create matlab.apps.AppBase

matrix matlab,for loop,gaussian elimination,carl friedrich gauss (academic),computer,robot,object-oriented programming (programming language paradigm),matlab lectures,course,language,engineer,simulation,math,computer programming (professional field),robots,mechanics,matlab video lectures,matlab introduction,noamn 360 degree


classdef app5_exported < matlab.apps.AppBase

    % Properties that correspond to app components
https://amzn.to/2SotVlZ
    properties (Access = public)
        UIFigure      matlab.ui.Figure
        GaugeLabel    matlab.ui.control.Label
        Gauge         matlab.ui.control.Gauge
        %%
        %
        % <<FILENAME.PNG>>
        %
        GoneLabel     matlab.ui.control.Label
        SavedLabel    matlab.ui.control.Label
        JustOkLabel   matlab.ui.control.Label
        BonusLabel    matlab.ui.control.Label
        JackpotLabel  matlab.ui.control.Label
        PlayButton    matlab.ui.control.Button
        Spinner       matlab.ui.control.Spinner
    end

 
    properties (Access = private)
     
    end
 

    methods (Access = private)

        % Button pushed function: PlayButton
        function PlayButtonPushed(app, event)
            for i = 1:20
                pause(0.5);
                r = randi([-100 100]);
                app.Gauge.Value =r;
                app.Spinner.Value = r;
            end
         
            app.Gauge.BackgroundColor = [1,0,0]; % Red Colour
            pause(1);
            app.Gauge.BackgroundColor = [0,1,0]; % Green Colour
            pause(1);
            app.Gauge.BackgroundColor = [0,0,1]; % Blue Colour
         
         
        end
    end

    % App initialization and construction
    methods (Access = private)

        % Create UIFigure and components
        function createComponents(app)

            % Create UIFigure
            app.UIFigure = uifigure;
            app.UIFigure.Position = [100 100 640 480];
            app.UIFigure.Name = 'UI Figure';

            % Create GaugeLabel
            app.GaugeLabel = uilabel(app.UIFigure);
            app.GaugeLabel.HorizontalAlignment = 'center';
            app.GaugeLabel.FontColor = [1 1 1];
            app.GaugeLabel.Position = [176 109 42 22];
            app.GaugeLabel.Text = 'Gauge';

            % Create Gauge
            app.Gauge = uigauge(app.UIFigure, 'circular');
            app.Gauge.Limits = [-100 100];
            app.Gauge.ScaleColors = [0 1 0;0.0588 1 1;1 1 0;0.9294 0.6902 0.1294;1 0 0];
            app.Gauge.ScaleColorLimits = [60 100;20 60;-20 20;-60 -20;-100 -60];
            app.Gauge.FontColor = [1 1 1];
            app.Gauge.Position = [54 146 287 287];

            % Create GoneLabel
            app.GoneLabel = uilabel(app.UIFigure);
            app.GoneLabel.FontSize = 20;
            app.GoneLabel.Position = [22 179 71 24];
            app.GoneLabel.Text = 'Gone!!!';

            % Create SavedLabel
            app.SavedLabel = uilabel(app.UIFigure);
            app.SavedLabel.FontSize = 20;
            app.SavedLabel.Position = [3 342 90 25];
            app.SavedLabel.Text = 'Saved....';

            % Create JustOkLabel
            app.JustOkLabel = uilabel(app.UIFigure);
            app.JustOkLabel.FontSize = 20;
            app.JustOkLabel.Position = [156 432 84 24];
            app.JustOkLabel.Text = 'Just...Ok';

            % Create BonusLabel
            app.BonusLabel = uilabel(app.UIFigure);
            app.BonusLabel.FontSize = 20;
            app.BonusLabel.Position = [308 376 79 24];
            app.BonusLabel.Text = 'Bonus!!!';

            % Create JackpotLabel
            app.JackpotLabel = uilabel(app.UIFigure);
            app.JackpotLabel.FontSize = 20;
            app.JackpotLabel.Position = [296 179 74 24];
            app.JackpotLabel.Text = 'Jackpot';

            % Create PlayButton
            app.PlayButton = uibutton(app.UIFigure, 'push');
            app.PlayButton.ButtonPushedFcn = createCallbackFcn(app, @PlayButtonPushed, true);
            app.PlayButton.FontSize = 20;
            app.PlayButton.Position = [8 415 100 31];
            app.PlayButton.Text = 'Play';

            % Create Spinner
            app.Spinner = uispinner(app.UIFigure);
            app.Spinner.HorizontalAlignment = 'center';
            app.Spinner.FontSize = 36;
            app.Spinner.FontWeight = 'bold';
            app.Spinner.FontAngle = 'italic';
            app.Spinner.FontColor = [1 0.0745 0.651];
            app.Spinner.Position = [143 74 108 44];
        end
    end

    methods (Access = public)

        % Construct app
        function app = app5_exported

            % Create and configure 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

Reactions

Post a Comment

0 Comments