storing indices of some entries in a matrix

3 vues (au cours des 30 derniers jours)
R yan
R yan le 20 Avr 2014
Modifié(e) : Mischa Kim le 20 Avr 2014
I want to store the index of all the entries with value 5 in a matrix. is there an inbuilt function for it.

Réponses (1)

Mischa Kim
Mischa Kim le 20 Avr 2014
Modifié(e) : Mischa Kim le 20 Avr 2014
Ryan, use
[r c] = find(data==5)
r and c are the row and column indices of all data entries equal to 5.

Catégories

En savoir plus sur Resizing and Reshaping Matrices dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by