MATLAB: Does UIBUTTONGROUP not behave as expected when I set the ‘units’ property to ‘pixel’ in MATLAB 7.4 (R2007a)

MATLABnormalizedpixelpixelsposition;uibuttongroupuicontrolunitunits

I run the flollowing code, but I can not see the buttongroup:
fig1=figure('Position',[10 10 500 500]);
h1 = uibuttongroup('parent',fig1,'Position',[20 20 100 100],'units','pixels');

Best Answer

Since the 'units' property appears after the 'position' property in the above example of UIBUTTONGROUP command, the rectangle [20 20 100 100] is treated as if it is in 'normalized units', and then is converted into 'pixels units'. Therefore, the position rectangle in this example would be:[10000 10000 50000 50000] which is too large to be displayed in the figure.
To work around this issue, switch the place of 'position' and 'units' in the command, i.e.:
h1 = uibuttongroup('parent',fig1,'Position',[20 20 100 100],'units','pixels');