Run-length Encoding(Understanding with MATLAB)

Опубликовано: 04 Октябрь 2024
на канале: Knowledge Amplifier
3,885
29

If you want to know more about Run-length encoding , check the below link:

https://en.wikipedia.org/wiki/Run-len...

CODE:

clc
clear all
close all
x=input('Enter the array:');
y=[];
c=1;
for i=1:length(x)-1
if(x(i)==x(i+1))
c=c+1;
else
y=[y,c,x(i),];
c=1;
end
end
y=[y,c,x(length(x))];
disp(y);