istabular - Determine if input is table or timetable - MATLAB (original) (raw)

Main Content

Determine if input is table or timetable

Since R2021b

Syntax

Description

tf = istabular([A](#mw%5Fd9c1abc6-8216-4b07-b6dc-b5bea7e913c6)) returns logical1 (true) if A is either a table or a timetable, and logical 0 (false) otherwise.

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

Examples

collapse all

Create a table using the table function.

T = table([98;97.5;97.9;98.1;101],[120;111;119;117;118])

T=5×2 table Var1 Var2 ____ ____

  98    120 
97.5    111 
97.9    119 
98.1    117 
 101    118 

To confirm that T is either a table or a timetable, use the istabular function.

Now convert T to a timetable.

TT = table2timetable(T,'RowTimes',hours(1:5))

TT=5×2 timetable Time 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 

The istabular function still returns 1 for TT.

However, the istable function returns 0 because TT is a timetable, not a table.

Input Arguments

Extended Capabilities

expand all

Theistabular function fully supports tall arrays. For more information, see Tall Arrays.

Version History

Introduced in R2021b