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

1 次查看(过去 30 天)
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?

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Workspace Variables and MAT Files 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by