Select rows of different vector that matches a specific condition
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Jorge Luis Paredes Estacio
el 17 de Jul. de 2023
Comentada: Jorge Luis Paredes Estacio
el 17 de Jul. de 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 comentarios
Respuesta aceptada
Cris LaPierre
el 17 de Jul. de 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)]
Más respuestas (0)
Ver también
Categorías
Más información sobre Logical en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!