Main Content

istabular

Determine if input is table or timetable

    Description

    tf = istabular(A)returns logical1(true) ifAis either a table or a timetable, and logical0(false) otherwise.

    This syntax is equivalent totf = istable(A) || istimetable(A), but is more convenient.

    Examples

    collapse all

    Create a table using thetablefunction.

    T = table([98;97.5;97.9;98.1;101],[120;111;119;117;118])
    T=5×2 tableVar1 Var2 ____ ____ 98 120 97.5 111 97.9 119 98.1 117 101 118

    To confirm thatTis either a table or a timetable, use theistabularfunction.

    tf = istabular(T)
    tf =logical1

    Now convertTto a timetable.

    TT = table2timetable(T,'RowTimes',hours(1:5))
    TT=5×2 timetableTime Var1 Var2 ____ ____ ____ 1 hr 98 120 2 hr 97.5 111 3 hr 97.9 119 4 hr 98.1 117 5 hr 101 118

    Theistabularfunction still returns1forTT.

    tf = istabular(TT)
    tf =logical1

    However, theistablefunction returns0becauseTTis a timetable, not a table.

    tf = istable(TT)
    tf =logical0

    Input Arguments

    collapse all

    Input variable.

    Version History

    Introduced in R2021b