Why guidata() doesn't work on an user function?
Show older comments
Hi,
I have a variable stored in handles.switches.
I get into a callback function. I change this variable and at the end I execute guidata(hObject, handles) and this variable is updated. Fine.
The problem is if I update this variable in a user function inside this callback function. The handles.switches then is not updated although I execute at the end guidata(hObject, handles).
What can I do to update this variable inside other function?
I tried using set but it gives me an error. I am not using well this command.
>> set(handles.switches, 'UserData', work_comb);
Error using handle.handle/set
Invalid or deleted object.
But if I make a breakpoint at this line and write down handles.switches, the variable exists! I don't know what's going on...
Thanks!
1 Comment
Mike D.
on 19 Sep 2016
Use appdata instead.
Accepted Answer
More Answers (1)
Dani Tormo
on 5 Dec 2012
0 votes
Categories
Find more on Interactive Control and Callbacks in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!