find a value and their related values in other columns
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
SADRA SADEGHINEJAD
el 6 de Abr. de 2020
Comentada: SADRA SADEGHINEJAD
el 6 de Abr. de 2020
Hi, i have a matrix included some rows and columns and I want to find some certain values in the first columns then make a new matrix with them. I have tried with different ways but i couln`t reach to the solution.
example : let`s we have a matrix like this
degree cl
-3 0.01
0 0.04
+3 0.06
6 0.08
9 0.09
now I wanna find where the degree is +3 and 6 and then find their related value of Cl for them
0 comentarios
Respuesta aceptada
KALYAN ACHARJYA
el 6 de Abr. de 2020
Editada: KALYAN ACHARJYA
el 6 de Abr. de 2020
Let's example
mat=[-3 0.01
0 0.04
+3 0.06
6 0.08
9 0.09];
data_cl=mat(find(mat(:,1)==3 | mat(:,1)==6),2)
3 comentarios
KALYAN ACHARJYA
el 6 de Abr. de 2020
Editada: KALYAN ACHARJYA
el 6 de Abr. de 2020
Sure, use the any required logical indexing, to met the required condition, as you mentioned in the question
find(mat(:,1)==3 | mat(:,1)==6)
Gives the row index of the particular values, then you can ge the cl of respectice data in 2nd column
Más respuestas (0)
Ver también
Categorías
Más información sobre Matrix Indexing 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!