How to find the number of an element in a vector?

7 ビュー (過去 30 日間)
Sean Sydor
Sean Sydor 2017 年 9 月 30 日
回答済み: Sean Sydor 2017 年 9 月 30 日
Hi. I've got a 2 2500x1 vectors, and I've managed to find the x-cord of the local minimums. what I now need is a way to find the corresponding y value. I think my best bet is to find the 'number' of the minima (like how in [1, 5 ,7 ,2 , 3] 7 is the 3rd element, but I'm blanking on how to find that. In other words, I'm trying to find the element number of some number t in a vector T. (T is time, so I don't have to worry about any duplicate values).
Is there a way to do this? Or is there a better way to do this?

採用された回答

Sean Sydor
Sean Sydor 2017 年 9 月 30 日
I figured it out. Use the find function. If t is the number you're looking for in a vector T, then the index of t is find(T==t).

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by