Code covered by the BSD License  

Highlights from
Variable cardinality bookkeeping functions

from Variable cardinality bookkeeping functions by Edmund Brekke
These four functions makes it easy to work with lists of sets with variable cardinalities.

endInd2TCloud(endInd)
function tCloud = endInd2TCloud(endInd)

% Function to find lengths of each partition given end indices of the partitions
% Written by Edmund Brekke December 2007
% @ endInd:     End of each partition
% > tCloud:     Length of each partition


endInd = [0,endInd];
tCloud = diff(endInd);

if(~issorted(endInd))
   error('endInd is not sorted'); 
end

Contact us at files@mathworks.com