Wrap text for user interface control
Use this function only with GUIDE, or with apps created using the
figure
function
returns text wrapped at a character width that fits within the specified
wrappedtext
= textwrap(c
,txt
)UIControl
object, c
. The UI control object must be
one created with the uicontrol
function whose
'Style'
property value is set to 'text'
or
'edit'
. For example, c =
uicontrol('Style','text')
.
returns text that wraps each line at the specified number of characters. Spaces are included
in the character count. wrappedtext
= textwrap(c
,txt
,numchar
)textwrap
avoids splitting words when possible.
If a word cannot be accommodated within the specified number of characters, then
textwrap
moves it to the start of the next line.
[
also returns the recommended position for the UI control based on the text to be wrapped.
The returned position is one that allows the full text to display in the
wrappedtext
,position
] = textwrap(___)uicontrol
without clipping. If a UI control is not specified, the
position vector contains all zeros.