Main Content

plot

Draw graph connecting series of points on masked block icon

    Description

    plot(y) plots against an implicit set of x-coordinates.

    • If y is a vector, the x-coordinates range from 1 to length(y).

    • If y is a matrix, the plot contains one line for each column in y. The x-coordinates range from 1 to the number of rows in y.

    plot(x1,y1,.......xn,yn) plots multiple pairs of x- and y-coordinates with in the same masked block. Vector pairs must be the same length.

    Input arguments can include NaN and inf values. When Simulink® encounters NaNs or inf values in an input argument to the plot function, it stops drawing and begins drawing again at the next numbers that are not NaNs or inf. The appearance of the plot on the icon depends on the Icon units setting in the Mask Editor.

    Simulink displays three question marks (? ? ?) in the block icon and issues warnings in these scenarios:

    • When you do not define values for the parameters used in the drawing commands.

    • When you enter a block parameter or drawing command incorrectly.

    The plot function used for drawing masked block icons supports a subset of the syntax of the MATLAB® plot function, supports all numeric data types, and accepts only numbers as input.

    example

    Examples

    collapse all

    Draw a masked block icon using vector indexes.

    plot([0 1 5])
    

    Straight line using vector indices

    Draw a masked block icon similar to the icon of the Ramp block in the Sources library.

    plot([0 1 5], [0 0 4])
    

    ramp block icon with plot command

    Input Arguments

    collapse all

    xcoordinates, specified as a vector. The x coordinate range from 0 to 1.

    Example: [10 20 30]

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

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

    Example: [20 30 40]

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

    Version History

    Introduced in R2006a

    See Also

    | | | |