Select rows of different vector that matches a specific condition
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Jorge Luis Paredes Estacio
am 17 Jul. 2023
Kommentiert: Jorge Luis Paredes Estacio
am 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 Kommentare
Akzeptierte Antwort
Cris LaPierre
am 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)]
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Logical finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!