Hi,
I understand that you want to program two buttons in App Designer, such that pressing one button will start clicking pictures in a loop and another button will stop this loop.
In order to do so, you can:
- Create a Boolean type variable "runLoop" with an initial value "false".
- Now, you can modify that variable inside the "MonitorizarButtonPushed()" with value "true". In this function, you can perform operations related to capturing the images.
- Inside the second callback function to stop this loop, you can modify the value of "runLoop" again to "false".
Please go through the below code to understand how you can add another variable and modify it in both the callbacks:
% Creating a variable which will work as a flag for capturing the images
% You can do this by clicking on Add Property option in "INSERT" section in
% the toolbar.
properties (Access = public)
runLoop = false;
end
% Callback function responsible for capturing the images in a loop
function MonitorizarButtonPushed(app, event)
% You can access the public variables using app.variableName
app.runLoop = true;
while runLoop
% Here, you can perform the operations to capture the images
end
end
% Callback function responsible for stopping the loop
function StopCapturingButtonPushed(app, event)
app.runLoop = false;
% This will make your loop stop
end
I hope the above modifications will help you to resolve your issue.