First adjacent difference greater than a certain value

2 ビュー (過去 30 日間)
Camille Woicekowski
Camille Woicekowski 2020 年 6 月 18 日
I have a table of measurements and the corresponding depth where the measurements were taken. I want to find the first location where the difference between two adjacent measurements is greater than a certain value.
For example, if I set the max difference to be 1 and I have
Depth Temp
12 cm 2
10 cm 1.3
8 cm 1.8
6 cm 0.5
4 cm -1.2
2 cm -2.5
I want it to return 6 cm, because that is the first place where the difference between adjacent temperatue values is greater than 1
Is there a command that would allow me to do this?

採用された回答

madhan ravi
madhan ravi 2020 年 6 月 18 日
編集済み: madhan ravi 2020 年 6 月 18 日
TabLE.Depth(find(abs(diff(TabLE.Temp)) > 1, 1) + 1)
  1 件のコメント
Camille Woicekowski
Camille Woicekowski 2020 年 6 月 18 日
Great, this worked perfectly. Thank you so much!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeData Exploration についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by