Main Content

Simulink.sdi.setSubplotLimits

R2026b

Specify subplot limits for time plots in the Simulation Data Inspector

    Description

    Simulink.sdi.setSubplotLimits(r,c,Name=Value) configures the time and y-axis limits for the subplot at the location specified by r and c on the active tab of the Simulation Data Inspector. Specify any combination of t-axis or y-axis limits using name-value arguments.

    Note

    Limits for the t-axis apply to all linked time plots in the Simulation Data Inspector. For more information, see Linked Subplots.

    example

    Examples

    collapse all

    To set the limits of the t-axis, use the tRange name-value argument, or set the minimum and maximum values independently using tMin and tMax. For example, set the timespan of all linked subplots to be from 2 to 8 seconds. Time axis limits apply to all linked subplots, so unless you have unlinked a subplot, you can use any set of subplot indices.

    Simulink.sdi.setSubplotLimits(1,1,tRange=[2,8])

    Suppose that you have two vertically aligned subplots in the Simulation Data Inspector. To copy the y-axis limits used in the upper subplot to the lower subplot, first get the y-axis limits of the upper subplot, then apply them to the lower subplot.

    [~,~,upperYMin,upperYMax] = Simulink.sdi.getSubplotLimits(1,1);
    Simulink.sdi.setSubplotLimits(2,1,yRange=[upperYMin,upperYMax])

    To set the axis limits for a subplot on a specific tab, specify the tab index using the TabIndex name-value argument. For example, set the y-axis range for the subplot in the first row and first column of the second tab in the Simulation Data Inspector.

    Simulink.sdi.setSubplotLimits(1,1,TabIndex=2,yRange=[0,5])

    Input Arguments

    collapse all

    Subplot row index, specified as an integer between 1 and 8, inclusive. Use the r and c inputs together to specify the location of the subplot for which you want to specify axis limits.

    Example: Simulink.sdi.setSubplotLimits(1,2,yRange=[0,3]) configures y-axis limits for the time plot in the first row of the second column of the subplot layout in the Simulation Data Inspector.

    Subplot column index, specified as an integer value between 1 and 8, inclusive. Use the r and c inputs together to specify the location of the subplot for which you want to specify axis limits.

    Example: Simulink.sdi.setSubplotLimits(1,2,yRange=[0,3]) configures y-axis limits for the time plot in the first row of the second column of the subplot layout in the Simulation Data Inspector.

    Name-Value Arguments

    collapse all

    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: Simulink.sdi.setSubplotLimits(2,1,yMin=0,yMax=3) configures y-axis limits for the time plot in the second row of the first column of the subplot layout in the Simulation Data Inspector.

    Since R2026b

    Tab index, specified as a positive integer between 1 and 8, inclusive. Tabs are indexed from 1 to 8, left to right. Reordering tabs in the Simulation Data Inspector updates the indices. When you do not specify TabIndex, the function operates on the active tab.

    Example: Simulink.sdi.setSubplotLimits(1,1,TabIndex=2,yRange=[0,5])

    Simulation Data Inspector view, specified as "inspect" or "compare". Specify the view with the subplot for which you want to specify limits. When you omit the 'View' argument, the limits are applied to the specified subplot in the inspect view.

    Example: Simulink.sdi.setSubplotLimits(2,1,View="compare",yRange=[-2,2]) configures y-axis limits for the difference plot in the compare view of the Simulation Data Inspector.

    t-axis minimum, specified as a scalar.

    Specify limits for the t-axis using the tMin and tMax name-value arguments, using the tRange argument, or using the AllRange argument. When you specify the tMin name-value pair argument, do not specify the tRange or AllRange arguments.

    Time axis limits apply to all linked subplots.

    t-axis maximum, specified as a scalar.

    Specify limits for the t-axis using the tMin and tMax name-value arguments, the tRange argument, or the AllRange argument. When you specify the tMax name-value argument, do not specify the tRange or AllRange arguments.

    Time axis limits apply to all linked subplots.

    y-axis minimum, specified as a scalar.

    Specify limits for the y-axis using the yMin and yMax name-value arguments, the yRange argument, or the AllRange argument. When you specify the yMin name-value argument, do not specify the yRange or AllRange arguments.

    y-axis maximum, specified as a scalar.

    Specify limits for the y-axis using the yMin and yMax name-value arguments, the yRange argument, or the AllRange argument. When you specify the yMax name-value argument, do not specify the yRange or AllRange arguments.

    t-axis range, specified as a 1-by-2 vector of numeric values.

    Specify limits for the t-axis using the tMin and tMax name-value arguments, the tRange argument, or the AllRange argument. When you specify the tRange name-value argument, do not specify the tMin, tMax, or AllRange arguments.

    Example: Simulink.sdi.setSubplotLimits(1,1,tRange=[-1,20]) configures the t-axis range for the subplot in the first row and first column of the Simulation Data Inspector and all linked subplots.

    Time axis limits apply to all linked subplots.

    y-axis range, specified as a 1-by-2 vector of numeric values.

    Specify limits for the y-axis using the yMin and yMax name-value arguments, the yRange argument, or the AllRange argument. When you specify the yRange name-value argument, do not specify the yMin, yMax, or AllRange arguments.

    Example: Simulink.sdi.setSubplotLimits(1,1,yRange=[-5,5]) configures the y-axis range for the subplot in the first row and first column of the Simulation Data Inspector.

    Data Types: double

    Ranges for t-axis and y-axis, specified as a 1-by-4 vector of numeric values. The values specified in the vector are mapped to the t-axis and y-axis limits in this order: [tMin,tMax,yMin,yMax].

    When you specify the AllRange name-value argument, do not specify the tMin, tMax, yMin, yMax, tRange, or yRange arguments.

    Time axis limits apply to all linked subplots.

    Example: Simulink.sdi.setSubplotLimits(1,1,AllRange=[-1,20,-5,5]) configures the y-axis range for the subplot in the first row and first column of the Simulation Data Inspector and t-axis range of that subplot and all linked subplots.

    Version History

    Introduced in R2021a

    expand all