finding the value in a table
Mostrar comentarios más antiguos
I have a table and I wish to store the value of the 'rating pts' column in a variable when the column 'yds per att'= 7.21 (there are two values in the table (see example).
What command do I use to get the value in the last column when another column is a value??
Thanks
Respuesta aceptada
Más respuestas (2)
Naga A
el 16 de Oct. de 2015
0 votos
Suppose if you store that table in the matrix named " table" then you can use this one:
table(find(table(:,column number of "yds per att")=="your required 'yds per att"),column_number of "Rating Pts")
Walter Roberson
el 16 de Oct. de 2015
0 votos
There are no entries which will have value exactly 7.21 . Finite binary floating point is not able to represent 0.21 exactly, because 1/10 = 0.1 (and so 0.01 and so 0.21) requires an infinite binary expansion, the same way that in decimal, 1/7 requires an infinite decimal expansion.
You need to test for values that are "close enough" to 7.21 for your purpose. abs(x-7.21) < tolerance for some positive tolerance such as 1E-10
Categorías
Más información sobre Tables 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!