Finding the first value in a matrix
Mostra commenti meno recenti
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.
Risposte (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)]
.
Categorie
Scopri di più su Creating and Concatenating Matrices in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!