I\'m very new with MatLab, I have Run Length Encoding code but it seems to not work, can you help me?
I have this input :
ChainCode = 110123211707
You can avoid the for loop:
chainCode = '11012321170701000700000700766666666666665555555544443344444333221322222322';
numCode = chainCode - '0'; % turn to numerical array
% detect edges (changes)
edges = arrayfun( @(x,y) x ~= y, ...
numCode(1:end-1), ...
numCode(2:end));
% get indexes
idx = find(edges);
% create tuples
relMat = cell2mat(arrayfun( ...
@(b,e) [ numCode(b) ; e-b+1 ], ...
[ 1 (idx + 1) ], ...
[ idx length(numCode) ], ...
'UniformOutput', false));