主要内容

getTabByName

R2026b

Get Simulation Data Inspector tab by name

Since R2026b

    Description

    tab = getTabByName(tabGroup,tabName) returns one or more Simulation Data Inspector tabs that have the name tabName.

    To access a Simulink.sdi.Tab object by specifying the tab index instead of the name, use getTabByIndex.

    example

    Examples

    collapse all

    Get the Tab object corresponding to the tab named Tab3. First, access the TabGroup object. Then, use that object to get the tab.

    tabGroup = Simulink.sdi.TabGroup;
    tab3 = getTabByName(tabGroup,"Tab3")
    tab3 = 
    
      Tab with properties:
    
            Name: 'Tab3'
           Color: 'none'
           Index: 3
        IsActive: 1
    

    When you have multiple tabs that share a name, getTabByName returns an array of Tab objects. For example, suppose that you have two tabs named myTab. Access all tabs with the name myTab.

    myTabs = getTabByName(tabGroup,"myTab")
    myTabs = 
    
      1×2 Tab array with properties:
    
        Name
        Color
        Index
        IsActive

    You can also find the index of the tabs named myTab using the Index property of the Tab objects.

    myTabIndices = [myTabs.Index]
    myTabIndices = 1×2 uint64 row vector
    1	3

    Input Arguments

    collapse all

    Collection of tabs open in the Simulation Data Inspector, specified as a Simulink.sdi.TabGroup object.

    Tab name, specified as a string or character vector.

    Output Arguments

    collapse all

    Tabs matching specified name, returned as a Simulink.sdi.Tab object or an array of Simulink.sdi.Tab objects.

    Version History

    Introduced in R2026b