File Exchange

image thumbnail

Run Length Encoding

version (1.02 KB) by Suraj Kamya
Run Length Encoding - Loss less Coding Technique


Updated 05 Jun 2014

View License

% rleenc - Run Length Encoding Algorithm
% rleenc - function performs run length encoding for binary input sequence.
% ins - input sequence
% enc - encoded output
% For example, x=randint(1,10,[0 1]);
% Will give you a random sequence
% having only zeros and ones.
% enc=rleenc(x);
% developed by Suraj Kamya
% contact me:

Cite As

Suraj Kamya (2021). Run Length Encoding (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (4)

Reem Abdel hameed

Richard Johnson

The function randint is in the Communications toolbox, so it may not be the best example.
Also the rleenc function has some issues:
>> x = [0 1 0 0];
>> rleenc(x)
ans =

Suraj Kamya

Dear it will produce the vector having zeros and ones. Please re-check it will not produce empty vector.

Rudolf Musin

x=randint(1,10,[0 1]);

produce a empty Vector

MATLAB Release Compatibility
Created with R2013b
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

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

Start Hunting!