Finding the first value in a matrix
Afficher commentaires plus anciens
Hello,
In my matrix c, how do I find the first time the value 700 appears searching one row at a time before moving onto the next?
Thank you.
Réponses (2)
c = [0, 0, 700; 1, 2, 3; 4, 700, 1];
d = c.';
[col, row] = find(d == 700, 1)
Here the column index is replied at first, because the input was transposed.
I am not certain what you want.
Try this —
c = randi([650 750], 25);
[cr,cc] = find(c==700)
[RowMin,Idx] = min(cr)
First700 = [RowMin, cc(Idx)]
.
Catégories
En savoir plus sur Creating and Concatenating Matrices dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!