File Exchange

## block diagonal representation

version 1.0.0.0 (2.07 KB) by
Converts a matrix into a cell array of different sized matrices that make up the blocks.

Updated 11 Apr 2012

Essentially if one has a matrix M that they wish to store more efficiently in memory/use for function bldiagmult.m (same author), then use
cellform = blkdiagconv( M );
this is such that using the inbuilt Matlab function one has
M == blkdiag(cellform{:})
it is essentially the inverse function to blkdiag.

### Cite As

David Holdaway (2021). block diagonal representation (https://www.mathworks.com/matlabcentral/fileexchange/36142-block-diagonal-representation), MATLAB Central File Exchange. Retrieved .

tommsch

Yes indeed.

David H

I think tommsch

blkdiag( [0 0 0;0 1 0;0 0 0] );
yields {,[1 0;0 0]}.

Is the behaviour I actually intended, that way it is the inverse to blkdiag, unless I have missed something very obvious here.

tommsch

For the following matrix, the result is wrong or at least very unexpected:
blkdiag( [0 0 0;0 1 0;0 0 0] );
yields {,[1 0;0 0]}.
One should replace the lines
if k ==1
rngud(k,:) =[1,1];
else
rngud(k,:) = rngud(k-1,:);
end
with
rngud(k,:) = [k k];

##### MATLAB Release Compatibility
Created with R2012a
Compatible with any release
##### Platform Compatibility
Windows macOS Linux