height - Number of table rows - MATLAB (original) (raw)

Main Content

Syntax

Description

H = height([T](#btye26y-1-T)) returns the number of rows in the table, T.

height(T) is equivalent to size(T,1).

example

Examples

collapse all

Create a table, T.

LastName = {'Smith';'Johnson';'Williams';'Jones';'Brown'}; Age = [38;43;38;40;49]; Height = [71;69;64;67;64]; Weight = [176;163;131;133;119]; BloodPressure = [124 93; 109 77; 125 83; 117 75; 122 80];

T = table(Age,Height,Weight,BloodPressure,'RowNames',LastName)

T=5×4 table Age Height Weight BloodPressure ___ ______ ______ _____________

Smith       38       71       176       124     93  
Johnson     43       69       163       109     77  
Williams    38       64       131       125     83  
Jones       40       67       133       117     75  
Brown       49       64       119       122     80  

Find the number of rows in table T.

T contains five rows; height does not count the variable names.

Input Arguments

Extended Capabilities

expand all

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

This function fully supports code generation. For more information, see Code Generation for Tables (MATLAB Coder).

The height function fully supports GPU arrays. To run the function on a GPU, specify the input data as a gpuArray (Parallel Computing Toolbox). For more information, see Run MATLAB Functions on a GPU (Parallel Computing Toolbox).

Version History

Introduced in R2013b

expand all

The height function returns the number of rows of an input array having any data type. In previous releases, callingheight resulted in an error if the input was not a table or timetable.