Mapping Toolbox | ![]() ![]() |
Fill in regions of indexed matrix maps with specified values
Syntax
Description
This command fills in regions of matrix maps with desired values. If a boundary exists, the new value will replace 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 will try 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.
newmap = encodem(map,seedmat)fills in regions of the input matrix map, map
,
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]
.
newmap = encodem(map,seedmat,stopvals) allows you to specify a vector, stopvals
, of stopping values. Any value that is an element of stopvals
will act as a boundary.
Examples
For this imaginary map, fill in the upper right region with 7s and the lower left region with 3s:
map = eye(4) map = 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 newmap = encodem(map,[4,1,3; 1,4,7]) newmap = 1 7 7 7 3 1 7 7 3 3 1 7 3 3 3 1
See Also
getseeds |
Interactively create seed matrix |
imbedm |
Encode data points into a regular matrix map |
maskm |
Replace entries of a matrix map specified by a mask matrix |
![]() | ellipse1 | epsm | ![]() |