|
ImageAnalyst <imageanalyst@mailinator.com> wrote in message <53705a9e-cf84-4590-9d9f-90b519ef6444@w36g2000vbi.googlegroups.com>...
> myString = sprintf('helo\nworld');
> set(handleToYourTextControl, 'String', myString);
>
> Or even better:
>
> myString = sprintf('Hello\nworld'); % Hello instead of helo.
> set(handleToYourTextControl, 'String', myString);
Unfortunately, the above solution only works for 'text'-style uicontrols, not for GUI uicontrols (buttons, checkboxes etc.).
For GUI uicontrols, you can use HTML formatting, as follows:
uicontrol('style','pushbutton', 'string','<html>Hello<br/><b><i>world!','pos',[20,20,60,60])
More information: http://UndocumentedMatlab.com/blog/html-support-in-matlab-uicomponents/
If you want HTML formatting (including support for colors, fonts, bold/italic etc.) in text labels, read these articles:
http://UndocumentedMatlab.com/blog/customizing-matlab-labels/
http://UndocumentedMatlab.com/blog/syntax-highlighted-labels-panels/
Yair Altman
http://UndocumentedMatlab.com
|