How to make radio button user interactive?

1 次查看(过去 30 天)
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 个评论
Adam
Adam 2015-4-24
编辑:Adam 2015-4-24
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.

请先登录,再进行评论。

采纳的回答

Brendan Hamm
Brendan Hamm 2015-4-24
编辑:Brendan Hamm 2015-4-24
You just need to set the radiobutton's callback function:
  3 个评论
Adam
Adam 2015-4-24
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
Brendan Hamm 2015-4-24
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.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Migrate GUIDE Apps 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by