From: Naresh Pai on
Doug Schwarz <see(a)sig.for.address.edu> wrote in message <wZq0n.14168$DY5.8113(a)newsfe08.iad>...
> Matt Fig wrote:
> > From the documentation:
> >
> > "For uicontrol objects that display only one line
> > of text (check box, push button, radio button, toggle button),
> > if the string value is specified as a cell array of strings or padded
> > string
> > matrix, only the first string of a cell array or of a padded string matrix
> > is displayed; the rest are ignored. Vertical slash ('|') characters are not
> > interpreted as line breaks and instead show up in the text displayed in the
> > uicontrol."
> >
> > You might be able to do something with the underlying JAVA. Putting a
> > textbox over the top of the pushbutton introduces problems as well,
> > because clicking on the string will not trigger the pushbutton's callback.
> >
> > We will bring the JAVA man to this thread:
> >
> > Calling Yair Altman!
>
> Indeed, I would be interested in a Java way to do this, but in the
> meantime my uibutton is available:
>
> <http://www.mathworks.com/matlabcentral/fileexchange/10743-uibutton-gui-pushbuttons-with-better-labels>
>
> --
> Doug Schwarz
> dmschwarz&ieee,org
> Make obvious changes to get real email address.

Thanks Doug! That works perfect for now. Here is the updated code (after downloading uibutton), if someone is interested:

% Intialize a figure
hf = figure('Name','GUI');

% Define a string for button
string = {'ABC DEF',...
'GHI JKL'};

% Define a uicontrol button
Btn_temp = uibutton(...
'Parent',hf,...
'Units','normalized',...
'Position',[0.7,.15,.2,.1],...
'Style','pushbutton',...
'String',string);

--Naresh
From: Yair Altman on
"Matt Fig" <spamanon(a)yahoo.com> wrote in message <hhtccq$7o1$1(a)fred.mathworks.com>...
> From the documentation:
>
> "For uicontrol objects that display only one line
> of text (check box, push button, radio button, toggle button),
> if the string value is specified as a cell array of strings or padded string
> matrix, only the first string of a cell array or of a padded string matrix
> is displayed; the rest are ignored. Vertical slash ('|') characters are not
> interpreted as line breaks and instead show up in the text displayed in the
> uicontrol."
>
> You might be able to do something with the underlying JAVA. Putting a textbox over the top of the pushbutton introduces problems as well, because clicking on the string will not trigger the pushbutton's callback.
>
> We will bring the JAVA man to this thread:
>
> Calling Yair Altman!

Simply use HTML formatting:
set(Btn_temp, 'String', '<html>ABC DEF<br>GHI JKL');

More information:
http://undocumentedmatlab.com/blog/html-support-in-matlab-uicomponents/

Yair Altman
http://UndocumentedMatlab.com