Extracting sequential values from a matrix taking into account two filter criteria
1 次查看(过去 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?
0 个评论
采纳的回答
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))
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Matrices and Arrays 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!