title: R or MATLAB: permute a large sparse matrix into a block diagonal matrix
body: <p>I have a large sparse matrix, and I want to permute its rows or columns to turn the original matrix into a block diagonal matrix. Anyone knows which functions in R or MATLAB can do this? Thanks a lot.</p>