removevars
Delete variables from table.
📝Syntax
TB = removevars(TA, varsNames)
📥Input Arguments
Parameter Description
TA Input table.
varsNames Variable names in input table to remove: character vector, string array or cell array of character vectors.
📤Output Arguments
Parameter Description
TB Table object modified.
📄Description

TB = removevars(TA, varsNames) removes the variables specified by varsNames from the table TA and stores the remaining variables in T2.

You can specify the variables by name, position, or using logical indices.

You can also remove variables from a table using T(:, varsNames) = [].

💡Examples
C = {'John', 28, true; 'Alice', 35, false; 'Bob', 42, true};
% Convert the cell array to a table
T1 = cell2table(C)
T2 = removevars(T1, 'C2')
🔗See Also
tablerenamevars
🕔Version History
Version Description
1.9.0 initial version
Edit this page on GitHub