tail#

Purpose#

Returns the last n rows of a matrix, dataframe or string array.

Format#

h = tail(X[, n])#
Parameters:
  • X (Matrix, dataframe or string array) – the data to preview.

  • n (Scalar) – Optional input, the number of rows to return. Default = 5. If a negative number is supplied, all except the last n rows will be returned.

Returns:

h (Matrix, dataframe or string array) – The last n rows of X (or all but the last n rows of X, if n is negative).

Examples#

X = { 11 14,
      27 19,
      44 12,
      81 17,
      23 22,
      14 43 };

tail(X);

The above code will print:

27.000000        19.000000
44.000000        12.000000
81.000000        17.000000
23.000000        22.000000
14.000000        43.000000
tail(X, 3);

will print out:

81.000000        17.000000
23.000000        22.000000
14.000000        43.000000
tail(X, -2);

will print out:

11.000000        14.000000
27.000000        19.000000
44.000000        12.000000
81.000000        17.000000

See also

Functions: rows(), head()