Why a variable randomly is not updated in MATLAB GUI using guidata function?
Info
This question is closed. Reopen it to edit or answer.
Show older comments
Hello, I have a problem in a GUI made using MATLAB Guide.
I have some timer functions which are executed sequentially. There is one variable (handles.UserData.C_cnt) which is shared between the timer functions. The variable is not updated after some random number of the execution of the timer function and I cannot figure out why this occurs. Could you check if the following structure I use for updating the variables inside a timer function is correct?
function timer_fcn(obj,event,hObject,eventdata)
handles = guidata(hObject);
handles.UserData.C_cnt = handles.UserData.C_cnt+1;
guidata(hObject, handles);
3 Comments
Adam
on 7 Sep 2018
That single piece of code looks fine. How it interacts with the rest of your code we don't know though. I can fairly certainly say there is nothing 'random' about it though. Undiscovered, perhaps, but it will be purely logical unless your program actually includes randomness.
Stephen23
on 7 Sep 2018
@RZM: please upload your code by clicking the paperclip button.
Answers (0)
This question is closed.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!