tilenum

Gives the tile number of a given row and column in a tiled layout.

Category: Graphics > Formatting and Annotation

Syntax

n = tilenum(t, row, col)

Returns the number of the tile in row row and column col of layout t.

Description

Tiles are numbered row by row, so in a layout with c columns the tile at (row, col) has the number (row - 1)*c + col. The result can be passed to nexttile to select that tile. tilerowcol does the opposite conversion.

Input arguments

t
Layout created by tiledlayout.
row, col
Row and column of the tile, counted from 1.

Output arguments

n
Tile number, counted along rows from the top left.

Example

Numbers in a 2-by-3 layout

t = tiledlayout(2, 3);
tilenum(t, 1, 3)
tilenum(t, 2, 2)
Output
ans = 3
ans = 5

See also

tilerowcol nexttile tiledlayout subplot