10
10
10
10
10
Lastly, replace all of the NaN values in A with zeros and apply the logical NOT operator, ~A.
A(isnan(A)) = 0;
C = ~A
C = 5x5 logical array
0
1
1
1
0
0
1
0
1
1
1
1
0
0
0
0
0
1
0
0
0
0
0
0
0
The resulting matrix has values of logical 1 (true) in place of the NaN values, and logical 0 (false)
in place of the 10s. The logical NOT operation, ~A, converts the numeric array into a logical array
such that A&C returns a matrix of logical 0 (false) values and A|C returns a matrix of logical 1
(true) values.
See Also
nan | Logical Operators: Short Circuit | isnan | find | and | or | xor | not
Find Array Elements That Meet a Condition
5-5
Précédent

- 179/1450

Suivant