Getting the position of a value in a vector

조회 수: 2 (최근 30일)
Adam Palmer
Adam Palmer 2014년 8월 5일
댓글: Star Strider 2014년 8월 5일
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')
  댓글 수: 2
Adam Palmer
Adam Palmer 2014년 8월 5일
Thats just what I was going for, Thanks again Star Strider!!
Star Strider
Star Strider 2014년 8월 5일
Again, my pleasure!

댓글을 달려면 로그인하십시오.

추가 답변 (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