Selective plotting of values in waves

Hello,

If I have one column of data consisting of either 0 or 1 how can I make a plot of only the 1s in each column while still preserving the space in the time axis so that the whenever there is a 0 igor will not plot this point but will keep the gap in time and move on to the next point to check if it is a 0 or 1 etc....

Thanks for your time
modifygraph mask(tracename)={wavewithzeroesandones, 1, 1}
The first 1 says to include the points in "waveswithzeroesandones" that are equal the the given value. The second 1 is the given value.

John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
Thanks for the quick reply, this did what I was looking for. Out of curiosity, how can you create a new wave with these values because I would like to store the data of the newly created wave having only ones for example with the same gaps in time.
epiphenom wrote:
Thanks for the quick reply, this did what I was looking for. Out of curiosity, how can you create a new wave with these values because I would like to store the data of the newly created wave having only ones for example with the same gaps in time.

I guess that you mean to create a wave having all the values where the one wave has 1's. That would be the Extract operation. Something like
Extract/O datawave, newwave, wavewithonesandzeroes == 1

John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
Thanks for the reply. I tried running this command but it extracted only the ones and did not keep the relative spacing between ones and 0s so that the new wave was much shorter(because it only contained ones). I'm not sure if this is correct but is there any way to replace those values of 0 in my original wave with Nan and keep the ones so the wave length is preserved?
The screenshot shows what I would like as a wave and the original wave.
Screenshot_102813_013029_PM (2).jpg (14.71 KB)
Try the following:
Duplicate/O OriginalWave NewWave
NewWave = NewWave[p]==0 ? NaN : NewWave[p]

Hope this helps,
Kurt
You could certainly use KurtB's method of replacing the unwanted data with NaN. That will work for making a graph of the data. For some purposes the NaN's can get in the way.

If you would like to extract just the desired data, and your original data is waveform data (the X values are encoding in the Y data wave using the X scaling) then you would need to create an XY pair. You might do something like:
Duplicate YDataWave, newXData
newXData = x
Extract/O dataYwave, newYwave, wavewithonesandzeroes == 1
Extract/O dataXwave, newXData, wavewithonesandzeroes == 1

There are other ways to do this; probably one of our very clever customers could come up with something more efficient :)

John Weeks
WaveMetrics, Inc.
support@wavemetrics.com