필터 지우기
필터 지우기

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by