In/out signal from vector

3 ビュー (過去 30 日間)
Cary
Cary 2016 年 4 月 9 日
コメント済み: Azzi Abdelmalek 2016 年 4 月 9 日
Imagine I have the following vector:
0 0 0 0 0 1 1 1 0 0 1 1 1 1 1 0 0 0 1 1 1 1 1 1
The signal from the vector should be interpreted as follows: In at the 6th element, out at the 9th, in again at the 11th element, back out at the 17th, and finally back in at the 19th element through the end. What branch of code should I be using to tell me to get in at 6,11,19 and get out at 9,16?

採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2016 年 4 月 9 日
編集済み: Azzi Abdelmalek 2016 年 4 月 9 日
v=[0 0 0 0 0 1 1 1 0 0 1 1 1 1 1 0 0 0 1 1 1 1 1 1]
ii1=strfind(v,[0 1])+1
ii2=strfind(v,[1 0])+1
%or
ii1=strfind([0 v],[0 1])
ii2=strfind([v 0],[1 0])
  2 件のコメント
Cary
Cary 2016 年 4 月 9 日
Thanks Azzi! One more question...what if this was a column vector?
Azzi Abdelmalek
Azzi Abdelmalek 2016 年 4 月 9 日
transpose it

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMultirate Signal Processing についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by