Documentation

This is machine translation

Translated by Microsoft
Mouse over text to see original. Click the button below to return to the English verison of the page.

istable

Determine whether input is table

Syntax

Description

example

tf = istable(T) returns logical 1 (true) if T is a table. Otherwise, it returns logical 0 (false) otherwise.

Examples

collapse all

Determine if Workspace Variable Is Table

Create a workspace variable, T.

T = table(categorical({'M';'F';'M'}),[45 45;41 32;40 34],...
    {'NY';'CA';'MA'},[true;false;false])
T = 

    Var1      Var2      Var3    Var4 
    ____    ________    ____    _____

    M       45    45    'NY'    true 
    F       41    32    'CA'    false
    M       40    34    'MA'    false

Verify that the workspace variable, T, is a table.

istable(T)
ans =

     1

T is a table.

Determine if Subset of Table Is Table

Create a table, T.

T = table(categorical({'M';'F';'M'}),[45 45;41 32;40 34],...
    {'NY';'CA';'MA'},[true;false;false])
T = 

    Var1      Var2      Var3    Var4 
    ____    ________    ____    _____

    M       45    45    'NY'    true 
    F       41    32    'CA'    false
    M       40    34    'MA'    false

Determine if the subset of table T that contains only the second and fourth variables is a table.

istable(T{:,[2 4]})
ans =

     0

Conversely, accessing data with curly braces, T{:,[2 4]}, returns a matrix and not a table.

Input Arguments

collapse all

T — Input variableworkspace variable

Input variable, specified as a workspace variable. T can be any data type.

Introduced in R2013b

Was this topic helpful?