Find the number of rows and column of non-zero number(1st)

1 vue (au cours des 30 derniers jours)
fyza affandi
fyza affandi le 27 Nov 2018
Commenté : fyza affandi le 27 Nov 2018
Given matrix of Mat. How can I find the number of row & column of the 1st non-zero number?
Mat =
0 0
0 0
0 0
0 0
0 0
0 1
1 1
The result should be:-
a=[6 2]

Réponse acceptée

Bruno Luong
Bruno Luong le 27 Nov 2018
[c,r] = find(Mat.',1,'first');
a = [r,c]

Plus de réponses (0)

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