Issue with push button userdata

5 views (last 30 days)
Jason
Jason on 27 Sep 2019
Commented: Himanshu Jain on 24 Aug 2021
Hello.
I am trying to enable a push button to exit a loop if its pressed and decided to user the buttons "UserData".
So I initially set it to 0.
set(handles.btnStop, 'userdata',0)
in my loop, i then check the status of this with an if statement
if get(handles.btnStop, 'userdata') % stop condition
break;
end
In a stop push button I set the user data to 1
set(handles.btnStop, 'userdata',1)
But Im getting a strange result.
when I check what the userdata is berfore I go into the loop (via set(handles.btnStop, 'userdata',0)), I see its a cell array with 2 elements:
ans =
2×1 cell array
{[0]}
{[0]}
  1 Comment
Himanshu Jain
Himanshu Jain on 24 Aug 2021
I am not able to reproduce the same issue, I am getting the expected results. Can you please send more info about the issue. Also if possible, please share the code in which this issue is occuring.

Sign in to comment.

Answers (0)

Categories

Find more on Graphics Object Programming 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!