You can replace all instances of -1 with NaN using the following MATLAB command:
main.m20 chars2 lines
This command first creates a logical array with the same size as age
by checking which elements are equal to -1, using the logical operator ==
. It then uses this logical array to index into age
, and sets the corresponding elements to NaN
.
gistlibby LogSnag