Select rows of different vector that matches a specific condition
3 views (last 30 days)
Show older comments
Jorge Luis Paredes Estacio
on 17 Jul 2023
Commented: Jorge Luis Paredes Estacio
on 17 Jul 2023
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.
0 Comments
Accepted Answer
Cris LaPierre
on 17 Jul 2023
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)]
More Answers (0)
See Also
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!