extract numbers form a column
Mostrar comentarios más antiguos
I have a double collumn set of data, something like that:
Q= [0 15
0 18
0 12
1 12
2 15
0 17
0 12
2 7
0 12
0 11]
I need to get the mean values of ech array in column 2, where are zeros in column 1. Or at lest extract those aarays onto different variables, they need to be separated. Can anybody help me please?
Thank you
3 comentarios
Sargondjani
el 17 de En. de 2021
Editada: Sargondjani
el 17 de En. de 2021
Try something like:
ind0 = Q(:,1) ==0%select the entries where Q(:,1) is 0
Sum_Q0 = mean(Q(ind0,2))%take the mean of the entries of Q(:,2) where ind0==1
This might not be fasted way, but its simple :-)
ShonyE
el 17 de En. de 2021
dpb
el 17 de En. de 2021
See below...
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Matrix Indexing en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!