r - Identify every submatrix satisfying condition -


in following matrix i'm trying identify every largest rectangles formed 1's shown in picture. rectangles can have 1 row if have more 3 columns. rectangles can have 1 column if have more 3 rows. rectangles should have less maxcol columns , maxrow rows , more mincol , minrow. in picture mincol=minrow=2. maxrow=maxcolumn=6

tried use subset function provides 1's submatrixs not every superimposed rectangles.

mdat <- matrix(c(0,1,1,1,0,0,0,1,0,1,1,1,1,1,1,1,1,1,0,1,0,1,1,0), nrow = 4, ncol = 6, byrow = true)   dimnames(mdat) <- list(  c("row1", "row2", "row3","row4"), c("col1", "col2", "col3", "col4","col5","col6"))  

identified rectangles


Comments

Popular posts from this blog

Change the color of an oval at click in Java AWT -

c# - Unity IoC Lifetime per HttpRequest for UserStore -

I am trying to solve the error message 'incompatible ranks 0 and 1 in assignment' in a fortran 95 program. -