Mapping Toolbox | ![]() ![]() |
Replace entries with certain values throughout a matrix map
Syntax
mapout = changem(map,newcode) mapout = changem(map,newcode,oldcode)
Description
mapout = changem(map,newcode,oldcode) returns a matrix map mapout
identical to the input matrix map
, except that each element of map
with a value contained in the vector oldcode
is replaced by the corresponding element of the vector newcode
.
oldcode
is 0 (scalar) by default, in which case newcode
must be scalar. Otherwise, newcode
and oldcode
must be the same size.
Examples
map = magic(3)
map =
8 1 6
3 5 7
4 9 2
Replace instances of 8
or 9
with 0
's:
mapout = changem(ans,[0 0],[9 8])
mapout =
0 1 6
3 5 7
4 0 2
See Also
maskm |
Mask out specified matrix map entries |
![]() | cen2geod | clabelm | ![]() |