classdef appLab_4_3_5 < matlab.apps.AppBase

  % Properties that correspond to app components
  properties (Access = public)
    UIFigure  matlab.ui.Figure
    UIAxes    matlab.ui.control.UIAxes
  end

  
  properties (Access = private)
    Timer       % Timer
    rundgang    % Objekt für Rundgang 
  end
  
  methods (Access = private)
    
    function results = LoopFnc(app, obj, event, string_arg)
      app.rundgang = laufe( app.rundgang ); 
      results = 0;      
    end
  end
  

  % Callbacks that handle component events
  methods (Access = private)

    % Code that executes after component creation
    function startupFcn(app)
      app.rundgang = Rundgang( app.UIAxes );
      app.Timer = timer('Name','Timer', ...
                  'Period', 0.5, ...
                  'BusyMode', 'queue', ...
                  'StartDelay', 1,... 
                  'ExecutionMode', 'fixedrate',...
                  'TimerFcn', @app.LoopFnc );
      start( app.Timer );     % Timer starten 
    end

    % Close request function: UIFigure
    function UIFigureCloseRequest(app, event)
      stop(app.Timer);         % Timer stoppen 
      delete(app.Timer);       % Timer löschen      
      delete(app);     
    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 486 383];
      app.UIFigure.Name = 'MATLAB App';
      app.UIFigure.CloseRequestFcn = createCallbackFcn(app, @UIFigureCloseRequest, true);

      % Create UIAxes
      app.UIAxes = uiaxes(app.UIFigure);
      title(app.UIAxes, 'Rundgang')
      zlabel(app.UIAxes, 'Z')
      app.UIAxes.XColor = 'none';
      app.UIAxes.XTick = [];
      app.UIAxes.YColor = 'none';
      app.UIAxes.YTick = [];
      app.UIAxes.Position = [3 26 481 337];

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

      % Create UIFigure and components
      createComponents(app)

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

      % Execute the startup function
      runStartupFcn(app, @startupFcn)

      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