It seems like there should be a really easy way to mask waves, but I haven't been able to figure one out so far. For example, I might have to waves of the same length and I would like to delete all the points from the first wave where the corresponding point on the second wave is zero. The way I've been doing this so far is embarrassingly hackey:
Function DeletePointsInWave(w, wMask)Wave w //wave to have points deletedWave wMask //comparison wave; zeroes here will delete corresponding points in w//w and wMask are assumed to be same lengthVariable vNumPoints
Variable index
vNumPoints = DimSize(w,0)//have to do this from last point to first otherwise deleting points will change index of all points forward for(index = vNumPoints - 1; index >= 0; index -= 1)if(wMask[index] == 0)DeletePoints index, 1, w
endifendforEnd
My quick test shows that any point in wmask with a value of zero will cause the corresponding point in w to be deleted. There is no error checking, so watch out if it behaves unexpectedly. Hope this is what you have in mind.
Extract/O targetwave, targetwave, maskwave!=0 should also work. Be careful, targetwave is being overwritten! To avoid this, use a new name for destwave.
A
I'm trying something similar: I would like to use a piece of code that extracts a portion of a particular wave and use that portion to fill a new wave, rather than 'edit'-ing that wave and selecting the portion by mouse and ctrl+C&V. I would like to do something like the following:
I'm trying something similar: I would like to use a piece of code that extracts a portion of a particular wave and use that portion to fill a new wave, rather than 'edit'-ing that wave and selecting the portion by mouse and ctrl+C&V. I would like to do something like the following:
How about something like this?
My quick test shows that any point in wmask with a value of zero will cause the corresponding point in w to be deleted. There is no error checking, so watch out if it behaves unexpectedly. Hope this is what you have in mind.
January 2, 2012 at 03:19 pm - Permalink
Extract/O targetwave, targetwave, maskwave!=0
should also work. Be careful, targetwave is being overwritten! To avoid this, use a new name for destwave.A
January 8, 2012 at 12:48 am - Permalink
however that does not work. What would be the proper code to do this?
January 9, 2012 at 02:27 am - Permalink
January 9, 2012 at 07:11 am - Permalink
January 16, 2012 at 05:16 am - Permalink
May 17, 2012 at 11:37 am - Permalink