The following is a RLE code that found online and some part of it I added but couldn't understand the 6th,7th,8th line of code ,What is the diff part doing in this code?

1 visualización (últimos 30 días)
clc;
clear all;
close all;
chainCode =input('enter 1 & 0 string:--');
numCode = chainCode - '0' % turn to numerical array
J=find(diff([numCode(1)-1, numCode]));
z=numCode(J);
m=diff([J, numel(numCode)+1]);
rle=[];
for i=1:length(m)
rle=[rle m(i) z(i)];
end
final=num2str(rle)

Respuestas (0)

Categorías

Más información sobre Denoising and Compression en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by