how to find the line number of a point in a vector

3 ビュー (過去 30 日間)
gjashta
gjashta 2019 年 9 月 4 日
コメント済み: gjashta 2019 年 9 月 4 日
I have a vector i=[0 0 1 1 1 1 0 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 1 1 1 1 0 0 0 0].
What can I use to find in which line number starts and ends number 1 each time?

採用された回答

madhan ravi
madhan ravi 2019 年 9 月 4 日
Start = strfind([0,ii],[0 1])
End = strfind([ii,0],[1 0])
  1 件のコメント
gjashta
gjashta 2019 年 9 月 4 日
Thank you madhan ravi for you quick response!

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

その他の回答 (1 件)

Fangjun Jiang
Fangjun Jiang 2019 年 9 月 4 日
編集済み: Fangjun Jiang 2019 年 9 月 4 日
a=diff(i)
find(a==1)
find(a==-1)
adjust by 1

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by