How to make radio button user interactive?
1 view (last 30 days)
Show older comments
Hi. This is GUI which is taking a query image and giving similar image images as output.I have radio buttons here.I want wen radio buttons is choosen that corresponding image above it is choosen and displayed in Retrieved images panel. secondly the functionality of Prev and Next pushbuttons.I want after Next is pushed another set of 20 images must be displayed.
Thanks in advance
2 Comments
Adam
on 24 Apr 2015
Edited: Adam
on 24 Apr 2015
Unfortunately this is one of those multi-part questions which mean an 'Answer' has to answer all parts of it to be a true answer. I don't have time to deal with the 'Next' and 'Prev' buttons so here is a comment of the radio buttons:
Radio buttons generally work best when contained within a uibuttongroup. This controls the mutual exclusivity that is a key part of radio buttons (and seems to be important for yours too - i.e. you don't want two selected at the same time). If you don't use a uibuttongroup you have to program callbacks for all your buttons (although the same callback for all should work), but within that you have to program the mutual exclusivity yourself which is tedious.
If you do use a uibuttongroup then you set the
'SelectionChangedFcn'
property of the uibuttongroup, query the
'SelectedObject'
of the buttongroup in this and then select your image based on that (which will be the handle of whichever of your radiobuttons is selected). If you have your radiobuttons all collected in an array and images also in a same-sized array you can find the index of your selected radio button within that array and use the same index into your image array to retrieve the correct image.
Accepted Answer
Brendan Hamm
on 24 Apr 2015
Edited: Brendan Hamm
on 24 Apr 2015
3 Comments
Adam
on 24 Apr 2015
You shouldn't really accept an answer if it doesn't answer your full question. Many people are not even going to look at this thread now that it has an accepted answer so you are unlikely to get an answer to the rest of your question now.
Brendan Hamm
on 24 Apr 2015
I actually meant to say you should set the callback function for the Next and Previous buttons, not the radiobuttons themselves. As Adam said you should use a uibuttongroup for the radiobuttons, this is much simpler to accomplish.
More Answers (0)
See Also
Categories
Find more on Migrate GUIDE Apps 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!