Indexing numbers for 2 or more specific values in a vector?

17 views (last 30 days)
How can I find the index numbers for 2 or more specific values in a vector called vec? Something like h=find(vec==26 & vec==437)

Accepted Answer

Bruno Luong
Bruno Luong on 7 Aug 2019
h = find(vec==26 | vec==437)
or
h = find(ismember(vec,[27 437]))

More Answers (0)

Categories

Find more on Matrices and Arrays in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!