Fill in regular data grid from seed values and locations
newgrid = encodem(Z,seedmat)
newgrid = encodem(Z,seedmat,stopvals)
newgrid = encodem(Z,seedmat) fills
in regions of the input data grid,
Z, with desired
new values. The boundary consists of the edges of the matrix and any
entries with the value
1. The seeds,
or starting points, and the values associated with them, are specified
by the three-column matrix
seedmat, the rows of
which have the form
[row column value].
newgrid = encodem(Z,seedmat,stopvals) allows
you to specify a vector,
stopvals, of stopping
values. Any value that is an element of
act as a boundary.
This function fills in regions of data grids with desired values. If a boundary exists, the new value replaces all entries in all four directions until the boundary is reached. The boundary is made up of selected stopping values and the edges of the matrix. The new value tries to flood the region exhaustively, stopping only when no new spaces can be reached by moving up, down, left, or right without hitting a stopping value.
For this imaginary map, fill in the upper right region with 7s and the lower left region with 3s:
Z = eye(4) Z = 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 newgrid = encodem(Z,[4,1,3; 1,4,7]) newgrid = 1 7 7 7 3 1 7 7 3 3 1 7 3 3 3 1