Why cant i see my radiobuttons ?

3 views (last 30 days)
Ian Broyles
Ian Broyles on 30 Oct 2020
Commented: Adam Danz on 31 Oct 2020
I'm working on an assignment where I create a GUI that has a an axis and then radio buttons to change the type of line, color, etc. However, when I add the uicontrol objects, they are not appearing on the GUI. The button group appears, but the individual buttons with text do not.
Here is my code for setting up the buttongroup:
mainplot.rb(1)=uibuttongroup('Visible','off','SelectionChangedFcn',{@radiobutton,1},'position',[.05 .12 .1 .3]);
and here is the code to set up on of the buttons:
red=uicontrol(mainplot.rb(1),'style','radiobutton','string','Red','position',[.1 .4 .1 .1],'units','normalized');
I tried setting the whole group to Visible, but that didn't work either. Also, for the postitioning, are the first two numbers the distance from the bottom-left of the figure window, or the bottom-left of the button group window? I think that's the issue I'm having. but I dont know for sure. I've tried many different sets of values, just to try to get it into view, to no avail. I am using 2020a, if that helps

Accepted Answer

Adam Danz
Adam Danz on 31 Oct 2020
From the documentation,
Setting Property Units
Note that if you are setting both the FontSize and the FontUnits properties in one function call, you must set the FontUnits property first so that the MATLAB software can correctly interpret the specified FontSize. The same applies to figure and axes units — always set the Units property before setting properties whose values you want to be interpreted in those units. For example,
f = figure('Units','characters','Position',[30 30 120 35]);
  2 Comments
Ian Broyles
Ian Broyles on 31 Oct 2020
I just tried this and I'm still having the same problem. I set the units in my figure to 'normalized', set up the 'position' array accordingly and the radiobuttons still wont appear.
Adam Danz
Adam Danz on 31 Oct 2020
That's a quote from the documentation, not a solution to the problem.
Given that information, you need to apply it to this line
red=uicontrol(mainplot.rb(1),'style','radiobutton','string','Red','position',[.1 .4 .1 .1],'units','normalized');

Sign in to comment.

More Answers (0)

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!