Borrar filtros
Borrar filtros

Getting the position of a value in a vector

3 visualizaciones (últimos 30 días)
Adam Palmer
Adam Palmer el 5 de Ag. de 2014
Comentada: Star Strider el 5 de Ag. de 2014
Hey Matlab community, I have another one for you all. I have a vector of values BAC_F that corresponds with time, and I want the first position of BAC(BAC_F<.08) , but I can't quite figure it out. Any help and suggestions are appreciated.

Respuesta aceptada

Star Strider
Star Strider el 5 de Ag. de 2014
If you want the index of the first value where BAC < 0.08:
BACx = find(BAC < 0.08, 1, 'first')
  2 comentarios
Adam Palmer
Adam Palmer el 5 de Ag. de 2014
Thats just what I was going for, Thanks again Star Strider!!
Star Strider
Star Strider el 5 de Ag. de 2014
Again, my pleasure!

Iniciar sesión para comentar.

Más respuestas (1)

Ben11
Ben11 el 5 de Ag. de 2014
Editada: Ben11 el 5 de Ag. de 2014
YourVector = BAC(BAC_F<0.8)
Then
FirstValue = YourVector(1)
Is that what you meant?
If not it might simply be
YourVector = BAC_F < 0.8
Do you want to sort the array? Then you can use
sort(YourVector)
and then get the first element.

Categorías

Más información sobre MATLAB 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!

Translated by