Updating variables in a "real-time" GUI
Show older comments
I am making my first Matlab GUI, so please excuse my ignorance. I have done a few very simple practice GUIs to get myself started.
I want to make a Matlab GUI using GUIDE that has a central window running some image processing filters on a stream of sequential pictures I have stored on my computer. As the pictures are being filtered, I want to have numerical input boxes to the side that I can manipulate. As soon as I change a value in one of these input boxes, I will use the entered number to adjust the filters, and then the subsequent images processed should use the updated filter.
So in essence, what I want is a real-time image processing GUI with adjustable filter parameters.
Constructing the GUI is fine. I cannot foresee any major problems there. My question is, if I input a number to adjust my filters in some way, how do I get the images to use this updated filter?
I have thought of a number of leads that may or may not be useful: 1. Are there interrupt priority levels that I can assign to a change in a variable or an input box being used? 2. Would making the filter variables global mean that I can adjust them from the input box and the image processing algorithm would use the updated variable on the next image?
I am much obliged for any help received - even if it is 'lookup the words "Callback" and investigate "Matlab interrupt tables"' for example.
Mark
Accepted Answer
More Answers (1)
Walter Roberson
on 24 Mar 2011
1 vote
For greater certainty with respec to Matt's answer:
- No, there are no interrupt priority levels, and user interface routines have interaction queued (or discarded) if there is a running routine, until the running routine uses one of about 5 different function calls that specifically allow interrupts. The most straightforward of those calls is drawnow() which will allow the UI to run pending callbacks before returning to the routine in progress.
- Yes, using globals would have that effect. However, unless one has a lot of self-discipline about how globals are used, there is a fair chance that at some point you will change one global and forget about the interaction between it and another value. It isn't certain death of your program by any means, but as the scope of the program expands, the chance of an accidental and difficult to find conflict rises exponentially.
Categories
Find more on Debugging and Analysis 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!