table.tail
table: tail (tbl)
table: tail (tbl, k)
table: out = tail (tbl, k)
Display or return the last k rows of a table.
tail (tbl) displays the last eight rows of the table
tbl. If tbl has fewer than eight rows, then all rows are
displayed.
tail (tbl, k) displays the last k rows of the
table tbl. k must be a positive integer scalar value. If
tbl has fewer than k rows, then all rows are displayed.
out = tail (tbl, k) returns the last k
rows in a new table out instead of displaying them. If k is
omitted or empty, then it defaults to eight. If tbl has fewer than
k rows, then all available rows are returned.
The returned table preserves the variable names, row names, and all other properties of tbl.
Source Code: table
tail mirrors head, previewing the bottom of a table. With no count it returns the last 8 rows (or fewer if the table is short).
n = (1:20)';
T = table (string (num2str (n, 'ID%02d')), datetime (2024, 1, n), ...
categorical (mod (n, 3), 0:2, {'low', 'mid', 'hi'}), n .^ 2, ...
'VariableNames', {'Tag', 'Date', 'Band', 'Score'});
tail (T)
Tag Date Band Score
______ ___________ ____ _____
"ID13" 13-Jan-2024 mid 169
"ID14" 14-Jan-2024 hi 196
"ID15" 15-Jan-2024 low 225
"ID16" 16-Jan-2024 mid 256
"ID17" 17-Jan-2024 hi 289
"ID18" 18-Jan-2024 low 324
"ID19" 19-Jan-2024 mid 361
"ID20" 20-Jan-2024 hi 400
Pass a count to ask for a specific number of trailing rows.
tail (T, 3)
Tag Date Band Score
______ ___________ ____ _____
"ID18" 18-Jan-2024 low 324
"ID19" 19-Jan-2024 mid 361
"ID20" 20-Jan-2024 hi 400