method to do run length encoding on matrix $Id$
0001 function rlem = my_rle(m) 0002 % method to do run length encoding on matrix 0003 % 0004 % $Id$ 0005 0006 m = m(:); 0007 dps = [1; find(diff(m))+1]; 0008 rlem = [diff([dps; length(m)+1]), m(dps)];