textwrap
Wrap text for user interface control
Syntax
Description
Note
Using the textwrap
function with a UIControl
object is not supported in App Designer or in apps created using the
uifigure
function. Instead, to wrap text in a component such as a
Label
or a Button
, set the
WordWrap
property of the component to
'on'
.
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 for the given UI
control. 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.
returns text that wraps each line at the specified number of characters.wrappedtext
= textwrap(txt
,numchar
)
[
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.
Examples
Input Arguments
Output Arguments
Version History
Introduced before R2006a