find the first change and its position

2 ビュー (過去 30 日間)
Lev Mihailov
Lev Mihailov 2019 年 11 月 7 日
コメント済み: Daniel M 2019 年 11 月 7 日
Hello! I have a 100x10 matrix, I need to find the first change and its position (the number of this position is the right number). How do i do this?
A(100x1)=[20 20 20 20 20 14 10 10 10 10 10 .....]
A(100x2)=[140 150 140 140 120 110 100 100 100 100 100 .....]
I need to catch the moment when the values ​​decrease
The answer I should get
B1=6
B2=5
  1 件のコメント
Daniel M
Daniel M 2019 年 11 月 7 日
編集済み: Daniel M 2019 年 11 月 7 日
Wouldn't B2 = 3 since it goes from 150 to 140?

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

回答 (1 件)

darova
darova 2019 年 11 月 7 日
Use diff and find
  1 件のコメント
Daniel M
Daniel M 2019 年 11 月 7 日
And you can use multiple outputs for find to determine which row the results come from.

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

カテゴリ

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

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by