% 1) Create a custom property called myTimer, which would look like this:
properties (Access = private)
myTimer % Description
end
% 2) In your startup function, create your timer object, assign it to the custom property, and configure your timer callback. Something like this:
app.myTimer = timer('Period',2,...
'ExecutionMode', 'fixedSpacing', ...
'TasksToExecute', Inf);
app.myTimer.TimerFcn = @(x,y)disp('do something');