uicontrol radiobutton label text is offset vertically

조회 수: 3 (최근 30일)
CM
CM 2025년 4월 20일
답변: Deepak 2025년 6월 5일
See attached image. Is the alignment between the radiobuttons and the text correct? To me it looks like the text is too high. Is there a way to control this?
  댓글 수: 4
Walter Roberson
Walter Roberson 2025년 4월 20일
편집: Walter Roberson 2025년 4월 20일
I checked, and there are no apparent internal properties for controlling text position or text alignment for uicontrol()
CM
CM 2025년 4월 21일
Give this a go. I get higher text on the second one.
uicontrol('Style', 'radiobutton', 'String', 'Micro')
figWindow = uifigure('HandleVisibility', 'on');
uicontrol('Style', 'radiobutton', 'String', 'Micro')

댓글을 달려면 로그인하십시오.

답변 (1개)

Deepak
Deepak 2025년 6월 5일
Hi @CM,
I understand that you are noticing a slight misalignment between the radio buttons and their text labels when using "uicontrol('Style', 'radiobutton')", particularly when used inside a "uifigure". The "uicontrol" does not provide internal properties to control the vertical text alignment, so the text might appear slightly higher or off-center.
If you are working in a modern UI context, a better alternative is to use App Designer-style components such as "uibuttongroup" with "uiradiobutton", which offer improved layout and text alignment. Here is an example:
fig = uifigure;
bg = uibuttongroup(fig, 'Position', [100 100 200 100]);
uiradiobutton(bg, 'Text', 'Micro', 'Position', [10 60 100 20]);
uiradiobutton(bg, 'Text', 'Micro', 'Position', [10 40 100 20]);
uiradiobutton(bg, 'Text', 'Equal', 'Position', [10 20 100 20]);
Please find attached the documentation of functions used for referernce:
I hope this helps.

카테고리

Help CenterFile Exchange에서 Interactive Control and Callbacks에 대해 자세히 알아보기

제품


릴리스

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by