Find the number of rows and columns of non-zero number from certain row.

1 回表示 (過去 30 日間)
fyza affandi
fyza affandi 2018 年 11 月 28 日
コメント済み: fyza affandi 2018 年 11 月 28 日
Given a matrix named Matr below;
Matr =
0 0
0 0
1 0
0 0
2 0
0 1
1 1
How can I find the number of column and row form beginning of row to only row 6?
The result should be
[3 1
5 1
6 2]

採用された回答

YT
YT 2018 年 11 月 28 日
You can do something like this
[r, c] = find(Matr(1:6,:));
res = [r c]
%res =
%
% 3 1
% 5 1
% 6 2

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMultidimensional Arrays についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by