I have a matrix say, $a = \left[\matrix{ 0 & 1 & 0& 0& 0& 1& 0\\ 0& 0 &0 &0 &0 &1& 1\\ 1& 0 &0 &0 &0 &0 &0\\ 0 &1 &0 &0 &0 &0& 0\\ 0 &0 &1 &0 &1& 0& 0\\ 0& 0& 0 &1 &0 &0 &1}\right]$
I need to enumerate the non-zero elements into groups according to the following: - if two elements share a row or a column they are in the same group, and if say (1,2) & (1,6) in group1, then group1 will also include (2,6) & (2,7) & (6,7) & (4,2), I have been stuck with this fr a while, any help is deeply appreciated.
"if two elements share a row or a column they are in the same group" How?
"and if say (1,2) & (1,6) in group1, then group1 will also include (2,6) & (2,7) & (6,7) & (4,2)" Why not (6,4)?
Use MATLAB: