Accessing user variables from handles inside a timer function for a GUI

1 view (last 30 days)
I created a GUI which has a timer function inside of it. I've initialized my GUI with some variables inside a struct called 'Vars', ie, MyGui(Vars);
Inside of my GUI.m file, I can access the 'Vars' variable inside the opening function by stating, handles.Vars = varargin{:};
Now all my functions have access to this 'Vars' structure however my timer never sees it being updated. I can access the 'Vars' structure as it was when the GUI initialized, but if I change anything inside of 'Vars', it isn't reflected inside the timer.
handles.timer1 = timer('TimerFcn',{@timerFunction,hObject,handles},'StartDelay',0,'ExecutionMode','fixedRate','BusyMode','drop','Period',0.2);
Then inside 'timerFunction', I access handles.Vars and it's the initialized version and not the current.
Inside of one of my functions I am performing guidata also,
handles.Vars.UseOffset = 1; guidata(hObject, handles);
Why can't I see the updated handles structure inside the timer function?

Answers (0)

Categories

Find more on Dialog Boxes in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!