storing indices of some entries in a matrix

3 views (last 30 days)
R yan
R yan on 20 Apr 2014
Edited: Mischa Kim on 20 Apr 2014
I want to store the index of all the entries with value 5 in a matrix. is there an inbuilt function for it.

Answers (1)

Mischa Kim
Mischa Kim on 20 Apr 2014
Edited: Mischa Kim on 20 Apr 2014
Ryan, use
[r c] = find(data==5)
r and c are the row and column indices of all data entries equal to 5.

Categories

Find more on Resizing and Reshaping Matrices 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!