Locate values in dataset and output the corresponding time column

1 次查看(过去 30 天)
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.

回答(1 个)

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

类别

Help CenterFile Exchange 中查找有关 Resizing and Reshaping Matrices 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by