width
Number of variables in a table or timetable.
Category: Language Fundamentals > Data Types
Syntax
w = width(T)
Returns the number of columns of the table T, which is the number of variables.
Description
width(T) equals size(T, 2). A table variable can itself have several columns, but it still counts once. For a timetable the row times are not a variable, so they are not counted.
It pairs with height, which gives the number of rows.
Input arguments
T- A
table,timetableor ordinary array.
Output arguments
w- Nonnegative integer scalar.
Example
T = table([1;2;3], [4;5;6], 'VariableNames', {'a','b'});
width(T)
height(T)
Output
ans = 2
ans = 3