フィルターのクリア

transform column and row data of logical matrix to vector(N X 2)

1 回表示 (過去 30 日間)
sunghyun chung
sunghyun chung 2019 年 11 月 19 日
コメント済み: Ridwan Alam 2019 年 11 月 19 日
Hello
I would like to transfrom column and row data of logical matrix
to
vector matrix (N X 2)
eg.
** logical matrix
0 0 0 0
0 1 0 0
0 0 0 0
0 0 1 0
0 1 0 1
**to vector matrix (N X 2)
2 2
3 3
5 2
5 4
is there function to perform upper task?
thank you

採用された回答

Ridwan Alam
Ridwan Alam 2019 年 11 月 19 日
編集済み: Ridwan Alam 2019 年 11 月 19 日
logical_matrix = [0 0 0 0; 0 1 0 0; 0 0 0 0; 0 0 1 0; 0 1 0 1];
[i,j] = find(logical_matrix);
vector_matrix = [i,j]
% vector_matrix =
%
% 2 2
% 5 2
% 4 3
% 5 4
  2 件のコメント
sunghyun chung
sunghyun chung 2019 年 11 月 19 日
thanks a lot!
Ridwan Alam
Ridwan Alam 2019 年 11 月 19 日
Sure!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by