Eliminate or merge the sequences

5 ビュー (過去 30 日間)
Aravin
Aravin 2015 年 4 月 22 日
回答済み: Azzi Abdelmalek 2015 年 4 月 22 日
Hello everyone,
Using vectorization, I want to merge the sequences. Let say I have vector v with values
v = [43 43 43 33 34 35 35 43 43 43 43 43];
I want to get an other vector which should store on only
ind =[1 4 5 6 8];
The sequence should be eleminated and their index should be safed in ind.

回答 (2 件)

Kelly Kearney
Kelly Kearney 2015 年 4 月 22 日
ind = [1 find(diff(v) ~= 0)+1];

Azzi Abdelmalek
Azzi Abdelmalek 2015 年 4 月 22 日
ind=find(diff([v(1)+1 v]))

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by