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

1 次查看(过去 30 天)
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