rows

Purpose

Returns the number of rows in a matrix.

Format

y = rows(x)
Parameters:x (NxK matrix or sparse matrix) – data
Returns:y (scalar) – number of rows in the specified matrix.

Examples

x = ones(3, 3);
y = rows(x);
print x;
1.00  1.00  1.00
1.00  1.00  1.00
1.00  1.00  1.00
print y;
3.00

Remarks

Use getorders() to return both the number of rows and columns in one call.

If x is an empty matrix, rows(x) and cols(x) return 0.

See also

Functions cols(), getorders(), show