changem - Substitute values in data array
Syntax
mapout = changem(Z,newcode,oldcode)
Description
mapout = changem(Z,newcode,oldcode) returns
a data grid mapout identical to the input data
grid, except that each element of Z 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
Invent a map:
A = magic(3)
A =
8 1 6
3 5 7
4 9 2Replace instances of 8 or 9 with 0s:
B = changem(A,[0 0],[9 8])
B =
0 1 6
3 5 7
4 0 2
 | cart2grn | | circcirc |  |
Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
Get the Interactive Kit