MATLAB Answers


Why does "msgbox" add extra space?

Asked by Dave
on 19 Sep 2013
Latest activity Commented on by Ana
on 24 Mar 2014

I have a subroutine that reports avg and std values for up to 12 regions of interest in a single "msgbox" dialog. What I've noticed is that for multiple lines of text input to "msgbox", the figure adds extra space above the text area, which makes it look pretty ridiculous:

Any idea why the heck it does that?

  1 Comment

Can you show use the code?

Log in to comment.



No products are associated with this question.

1 Answer

Answer by Jan Simon
on 20 Sep 2013

While it does not answer your question, I want to mention that a msgbox might be a bad choice to display this text. You can create a more appropriate dialog using a listbox with scrolling.


Oh, ok..! But for this you should create a .fig in guide and call a different gui from your gui, right? Isn't there a more straightforward way?

I avoid working with GUIDE. You can create the required code manually also:

FigH     = figure('Menubar', 'none');
ListBoxH = uicontrol(FigH, 'Style', 'listbox', ...
                     'Units', 'Normalized', 'Position', [0,0,1,1], ...
                     'String', {'Yout text', 'E.g. split by TEXTWRAP()'})

Ok..! Thanks!

Log in to comment.

Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!