Locate values in dataset and output the corresponding time column

1 view (last 30 days)
I have a very large set of data, 3 columns with over 80,000 rows. I only need a couple points of data from this set. For example, I need the time value (which is the first column) at every point the second columns chagned from postive to negative, this happens throughout the dataset, but not in a pattern. Looking at the picture below I would need the time value at 8.827 right before the value changes to -2.017.
My thought process was to use the find function to find the negative number in the second column, but I am not sure how to distinguish the right negative number. Also I am not sure how to out the time after findind the negative value. Any help would be greatly appreciated.

Answers (1)

dpb
dpb on 27 May 2022
ix=find(diff(sign(x))==-2)-1;

Categories

Find more on Resizing and Reshaping Matrices in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!