Getting the position of a value in a vector

2 次查看(过去 30 天)
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.

采纳的回答

Star Strider
Star Strider 2014-8-5
If you want the index of the first value where BAC < 0.08:
BACx = find(BAC < 0.08, 1, 'first')

更多回答(1 个)

Ben11
Ben11 2014-8-5
编辑:Ben11 2014-8-5
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.

类别

Help CenterFile Exchange 中查找有关 Startup and Shutdown 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by