I'm trying to integrate data from one waveform graph that depends on the timestamps of another. What I have setup is digital waveform and an analog waveform and I would like to integrate over data from the analog waveform whenever the digital goes high.
My idea on how to approach this was to check when the digital input goes high and then low, and at the those timestamps as my limits of integration, however, I'm not sure how to go about this.
What I have tried to do was to take the digital input data and AND it with 1 to see if it is high, and then take that data and store its timestamp in an array and then input those values when integrate, but this is not the correct approach because it will not give me the right intervals for integration. I think what I am having trouble with is getting the timestamps of when the digital input goes high and then back to low.
Does anyone have any idea on how to approach this problem? I would appreciate any suggestions.
Thank you!