Main Content

text

Display text at specific location on masked block icon

    Description

    example

    text(x,y,inputText) displays the inputText at a location specified by the point (x,y). Use the Icon Units option in the Mask Editor to specify the units of measurement for x and y coordinates.

    text(x,y,inputText,texmode=IsTexMode) allows you to use TeX formatting commands in the text. The TeX formatting commands in turn allows you to include symbols and Greek letters in icon text. See Interpreter for information on the TeX formatting commands supported by Simulink® software.

    text(x,y,inputText,Name=Value) allows you to specify the horizontal and/or vertical alignment of the text relative to the point (x, y) in the text command.

    Examples

    collapse all

    In the Mask Editor, click the Icon tab in the center pane. In the Properties Editor pane, set Icon units to Normalized.

    Enter this command in the drawing commands editor in the center pane.

    text(0.05,0.5,'{\itEquation:}  \Sigma \alpha^2 +...
    \beta^2 \rightarrow \infty, \Pi, \phi_3 = {\bfcool}',... 
    HorizontalAlignment = 'left',texmode = 'on')
    

    Simulink block with a mask icon showing an equation

    Input Arguments

    collapse all

    x-coordinate of the location of text on the block icon , specified as a numeric scalar. The x coordinate range from 0 to 1.

    Example: text(0.3,0.4,'dy/dx')

    Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

    y coordinate, specified as a scalar. The y coordinate range from 0 to 1.

    Example: text(0.3,0.4,'dy/dx')

    Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

    Text to display on the masked icon, specified as a character vector or string scalar.

    Example: text(0.3,0.4,'dy/dx')

    Data Types: char | string

    Name-Value Arguments

    Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

    Example:

    Horizontal alignment of the text with respect to the x value in the Position property, specified as one of the values in this table

    Horizontal alignment options:

    Option

    Aligns

    'left'

    Align text to the left of the point(x,y)

    'right'

    Align text to the right of the of the point(x,y)

    'center'

    Center the text on the point(x,y)

    Example: text(0.7,0.8,'k',horizontalAlignment = 'center')

    Vertical alignment of the text with respect to the y value in the Position property, specified as one of the values in this table

    Option

    Aligns

    'base'

    Align baseline of the last line of text to the point(x,y)

    'bottom'

    Align bottom of the text at to the point(x,y)

    'middle'

    Align middle of the text at the point(x,y)

    'cap'

    Align capitals line of the text at the point(x,y)

    'top'

    Align top of the text to the point(x,y)

    Example: text(0.3,0.4,'dy/dx',verticalAlignment = 'cap')

    TeX formatting mode, specified as on or off. TeX formatting commands allow you to include symbols and Greek letters in icon text. See Interpreter for information on the TeX formatting commands supported by Simulink software.

    Version History

    Introduced before R2006a

    See Also

    | |