
Problem with Data Mask

A.M
I am having trouble using a mask. I would like to mask all my points that are not contained in the range -2 to 2. Previously I was using the command
mask = (chirpwavegauss >= -2 ? 1 : 0)
but I cannot make it work in this way :
mask = (2>= chirpwavegauss >= -2 ? 1 : 0)
How should I rewrite it to make it work?
Thanks!
November 12, 2012 at 04:14 am - Permalink
mask =( abs(chirpwavegauss)<=2 ) ? 1 : 0
November 12, 2012 at 06:03 am - Permalink
You don't need to use ?: here because the comparison operators (e.g., >=) and the logical operators (e.g., &&) both return 0 if false and 1 if true.
November 12, 2012 at 10:06 am - Permalink
November 15, 2012 at 03:33 am - Permalink
which should be more efficient.
November 15, 2012 at 10:36 am - Permalink