필터 지우기
필터 지우기

Cluster for binary matrix

조회 수: 5 (최근 30일)
Yuang
Yuang 2016년 5월 17일
댓글: Guillaume 2016년 5월 17일
I want to form clusters in a binary matrix. Every element in matrix is connected with 4 neighbors (top is connected with bottom and left is connected with right). Two types of clusters. One is elements connected with each other with value 1 and the other is value 0. Most of time, there are more than 2 clusters in a matrix since 0 and 1 are not connected each other.
If A = [1,0; 0,0], 2 clusters.
If A = [1,0; 0 1], 4 clusters.
If A = [1,0,1; 0,1,1; 1,1,0], 3 clusters, all 1s are connected , all 0s are not connected.
Of course, you can define something else for the matrix.
  댓글 수: 1
Guillaume
Guillaume 2016년 5월 17일
I couldn't see a question in your post. What is the problem you're having? How to count the clusters? How to generate a random matrix with a given number of clusters?

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Cluster Analysis and Anomaly Detection에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by