Geoscience Reference
In-Depth Information
K =
0 0 1
1 1 0
h e array
L(i,j)
is zero if
A(i,j)
is not in
B
, and one if
A(i,j)
is in
B
. We can
also locate elements within
A
for which a statement is true. For example we
can locate elements with values less than zero and replace them with
NaN
s by
typing
L = A;
L(find(L<0)) = NaN
or, more briel y
L(L<0) = NaN
which yields
L =
2 4 3
9 3 NaN
h is is very useful when working with digital elevation models, where values
below sea level are not relevant. Alternatively, we can replace data voids other
than
NaN
s such as
-32768
, which are ot en used with digital terrain models
(Section 7.3 to 7.5). We can then determine which elements of an array are
NaN
s by typing
M = isnan(L)
which yields
M =
0 0 0
0 0 1
where
NaN
s are indicated by ones and non-
NaN
values are indicated by zeros.
Which of the elements in array
A
are unique can be determined by typing
N = unique(A)
which yields
N =
-1
2
3
4
9