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

조회 수: 1 (최근 30일)
fyza affandi
fyza affandi 2018년 11월 27일
댓글: fyza affandi 2018년 11월 27일
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]

채택된 답변

Bruno Luong
Bruno Luong 2018년 11월 27일
[c,r] = find(Mat.',1,'first');
a = [r,c]

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Multidimensional Arrays에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by