フィルターのクリア

Extracting sequential values from a matrix taking into account two filter criteria

2 ビュー (過去 30 日間)
Dear Community,
from the provided Matrix I would like to extract a Data Package. If the value in row 2 of the Matrix exceeds the Symbol Threshold for the first time AND row 1 above shows a "1" , the Data Package begins. The Data Package ends when the value of row 2 exceeds the Symbol Threshold a second time AND the value above in row 1 again shows a "1". All values in between belong in the Data Package.
Symbol_Thres =
77.3500
Matrix =
0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
83 5 80 36 21 80 12 31 12 31 91 43 32 91 83 23
The Result should look like this:
Data_Package =
1 0 1 0 1 0 1 0 1
80 12 31 12 31 12 43 32 91
May you help me with this?

採用された回答

KSSV
KSSV 2021 年 5 月 3 日
Symbol_Thres = 77.3500 ;
Matrix = [0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
83 5 80 36 21 80 12 31 12 31 91 43 32 91 83 23] ;
idx = (Matrix(1,:)==1) & (Matrix(2,:)>Symbol_Thres) ;
id0 = find(idx) ;
iwant = Matrix(:,id0(1):id0(2))
iwant = 2×9
1 0 1 0 1 0 1 0 1 80 12 31 12 31 91 43 32 91
  1 件のコメント
Christian
Christian 2021 年 5 月 3 日
That was fast. The solution works! @KSSV thank you very much for the quick support!

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

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by