フィルターのクリア

Select rows of different vector that matches a specific condition

6 ビュー (過去 30 日間)
Hello, I have different matrices with different values that were estimated separately from a root matrix (acceleration signal). All the matrices has the similar length for example I will assume that I have three matrices (it may be more).
A=[0.25; 0.30; 0.20; 1.5; 1.3; ..... n]
B=[1; 1.30; 2.0; 3.5; 4.0; ..... n]
C=[-3; 0.25; 0.85; 1.2; -0.70; ..... n]
A new matrix is generated based on the condition that each row meets. For example the condition for each matrices may be the following:
A=A>1.2;
B=B>2.0;
C=C<-0.6
the result will be the following matrix
C=[5, 1.3, 4.0, -0.70] or C=[5], where 5 is the number of row that meets the condition. This will help me to identify the value of the acceleration signal (root matrix where A, B and C were derived) that is not accurate.
Thank you for your help.

採用された回答

Cris LaPierre
Cris LaPierre 2023 年 7 月 17 日
A=[0.25; 0.30; 0.20; 1.5; 1.3];
B=[1; 1.30; 2.0; 3.5; 4.0];
C=[-3; 0.25; 0.85; 1.2; -0.70];
row = (1:length(C))';
ind = A>1.2 & B>2.0 & C<-0.6;
newC = [row(ind) A(ind) B(ind) C(ind)]
newC = 1×4
5.0000 1.3000 4.0000 -0.7000

その他の回答 (0 件)

カテゴリ

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

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by