how to cluster bit strings using matlab
이전 댓글 표시
A= [ 1 0 0 0 0 0 1 1 0,
0 0 0 0 1 1 0 0 1,
1 1 1 1 1 1 1 0 0,
1 1 1 1 1 1 1 0 0,
1 0 0 0 0 0 1 1 0,
0 0 0 0 1 1 0 0 1,
1 1 1 1 1 1 1 1 1]
let A be the binary matrix.. 1 means there is decrease in production and 0 means there is increase in production ..
how will i cluster the same bit strings patterns?
i m working on health care data set[rows= 453 and col = 60] .. 1 represent decrease and 0 represent increase ..can this be possible using loops..
note: order of bits are important..// order dependent
댓글 수: 8
KSSV
2016년 5월 6일
what do you mean by cluster? You want the positions of 1 and 0?
kumud alok
2016년 5월 6일
KSSV
2016년 5월 6일
you can extract 0 and 1 from any matrix using find(mymatrix==1). It will give positions also. Then you can save..
kumud alok
2016년 5월 6일
kumud alok
2016년 5월 6일
Guillaume
2016년 5월 6일
A = [ 1 0 0 0 0 0 1 1 0, 0 0 0 0 1 1 0 0 1, 1 1 1 1 1 1 1 0 0, 1 1 1 1 1 1 1 0 0, 1 0 0 0 0 0 1 1 0, 0 0 0 0 1 1 0 0 1, 1 1 1 1 1 1 1 1 1]
"there are 7 bit strings separated by commas". No, there isn't. Please learn the matlab syntax, a comma is exactly the same as a space. A is a 1 x 63 vector.
If you were to use a semicolon between each group of 9, then A would be a 7 x 9 matrix:
A = [ 1 0 0 0 0 0 1 1 0; 0 0 0 0 1 1 0 0 1; 1 1 1 1 1 1 1 0 0; 1 1 1 1 1 1 1 0 0; 1 0 0 0 0 0 1 1 0; 0 0 0 0 1 1 0 0 1; 1 1 1 1 1 1 1 1 1]
Or you could put your 7 bit strings into a 1 x 7cell array containing 1 x 9 vectors
A = {[ 1 0 0 0 0 0 1 1 0], [0 0 0 0 1 1 0 0 1], [1 1 1 1 1 1 1 0 0], [1 1 1 1 1 1 1 0 0], [1 0 0 0 0 0 1 1 0], [0 0 0 0 1 1 0 0 1], [1 1 1 1 1 1 1 1 1]}
kumud alok
2016년 5월 6일
Walter Roberson
2016년 5월 6일
The original code used
A= [ 1 0 0 0 0 0 1 1 0,
0 0 0 0 1 1 0 0 1,
1 1 1 1 1 1 1 0 0,
and so on. MATLAB does know to treat the end of line line a semi-colon in that case.
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Matrix Indexing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!