Passing data using handles in GUI in functions with for loops?

1 view (last 30 days)
I can't quite figure out what I am doing wrong here. My function is long and has a number of variables that are working properly, so I focused on the important bits below. Upon GUI initialization, I create an array of zeros that I look to change values in later:
handles.ActiveCheck = zeros(1,64);
guidata(hObject,handles);
I then have a callback function based on a togglebutton that functions as a while loop while the program is running; this loop checks if a given value in the previously defined ActiveCheck is 1:
while true
for channel = [2,5,7]
if ActiveCheck(channel) = 1
plot(x)
end
end
end
Finally, I have a callback function for a checkbox (I have many checkboxes) that simply changes a given value in the array to 1:
handles.ActiveCheck(2) = 1
guidata(hObject,handles)
The problem I am running into is that while the checkbox callback is successfully changing the value to 1 at the given position, this change does not hold and is not seen by the looping while function.
  1 Comment
Daniel Henry
Daniel Henry on 10 Aug 2015
Nick, did you ever figure out a solution to this problem? I'm running into a similar issue right now.

Sign in to comment.

Answers (0)

Categories

Find more on Migrate GUIDE Apps 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!