height

Number of rows of a table.

Category: Language Fundamentals > Data Types

Syntax

h = height(T)

Returns the number of rows.

Description

height(T) equals size(T, 1), and reads more naturally for tables. Its companion is width, which counts the variables.

Input arguments

T
Table or timetable.

Output arguments

h
Nonnegative integer scalar.

Example

Rows of a table

T = table([1; 2; 3], {'a'; 'b'; 'c'}, 'VariableNames', {'x', 'y'});
height(T)
T(end+1, :) = {4, 'd'};
height(T)
Output
ans = 3
ans = 4

See also

width size numel table summary