Below I also posted the code from the DialogApp to better understand. Of course the way it's working right now is that both the DialogApp and my function take the default values I defined as 1 and 0 and run with that, without any influnence from the spinner of the DialogApp. I'm aware, there might be more than one problem with it. But what I really don't manage to fix is how to get the values from the DialogApp into my function.

classdef DialogApp < matlab.apps.AppBase
% Properties that correspond to app components
properties (Access = public)
UIFigure matlab.ui.Figure
OKButton matlab.ui.control.Button
toolorientationSpinner matlab.ui.control.Spinner
toolorientationSpinnerLabel matlab.ui.control.Label
speedupdownsampledatabySpinner matlab.ui.control.Spinner
speedupdownsampledatabySpinnerLabel matlab.ui.control.Label
end
properties (Access = private)
CallingApp % Description
end
% Callbacks that handle component events
methods (Access = private)
% Code that executes after component creation
function startupFcn(app, mainapp, dby, compass)
app.CallingApp=mainapp;
end
% Button pushed function: OKButton
function OKButtonPushed(app, event)
delete(app)
end
% Value changed function: speedupdownsampledatabySpinner
function speedupdownsampledatabySpinnerValueChanged(app, event)
dby = app.speedupdownsampledatabySpinner.Value;
end
% Value changed function: toolorientationSpinner
function toolorientationSpinnerValueChanged(app, event)
compass = app.toolorientationSpinner.Value;
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 254 226];
app.UIFigure.Name = 'MATLAB App';
% Create speedupdownsampledatabySpinnerLabel
app.speedupdownsampledatabySpinnerLabel = uilabel(app.UIFigure);
app.speedupdownsampledatabySpinnerLabel.HorizontalAlignment = 'center';
app.speedupdownsampledatabySpinnerLabel.Position = [40 173 176 45];
app.speedupdownsampledatabySpinnerLabel.Text = {'speed up '; '(downsample data by:)'};
% Create speedupdownsampledatabySpinner
app.speedupdownsampledatabySpinner = uispinner(app.UIFigure);
app.speedupdownsampledatabySpinner.Limits = [1 10000];
app.speedupdownsampledatabySpinner.RoundFractionalValues = 'on';
app.speedupdownsampledatabySpinner.ValueChangedFcn = createCallbackFcn(app, @speedupdownsampledatabySpinnerValueChanged, true);
app.speedupdownsampledatabySpinner.HorizontalAlignment = 'center';
app.speedupdownsampledatabySpinner.Position = [84 155 103 22];
app.speedupdownsampledatabySpinner.Value = 1;
% Create toolorientationSpinnerLabel
app.toolorientationSpinnerLabel = uilabel(app.UIFigure);
app.toolorientationSpinnerLabel.HorizontalAlignment = 'right';
app.toolorientationSpinnerLabel.Position = [86 80 84 22];
app.toolorientationSpinnerLabel.Text = 'tool orientation';
% Create toolorientationSpinner
app.toolorientationSpinner = uispinner(app.UIFigure);
app.toolorientationSpinner.Limits = [0 360];
app.toolorientationSpinner.ValueChangedFcn = createCallbackFcn(app, @toolorientationSpinnerValueChanged, true);
app.toolorientationSpinner.Position = [86 105 84 22];
% Create OKButton
app.OKButton = uibutton(app.UIFigure, 'push');
app.OKButton.ButtonPushedFcn = createCallbackFcn(app, @OKButtonPushed, true);
app.OKButton.FontWeight = 'bold';
app.OKButton.Position = [52 18 151 39];
app.OKButton.Text = 'OK';
% 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 = DialogApp(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