# matrix with 10 rows and 7 columns
M = matrix(rnorm(70), 10, 7)
# row blocks
row_sets = list(1:3, 4:5, 6:10)
# split matrix by rows
matrix_to_blocks(M, row_sets)
# column blocks
col_sets = c(3, 4)
# split matrix by rows
matrix_to_blocks(M, col_sets, byrow=FALSE)
Run the code above in your browser using DataLab