No License

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Highlights from
Huffman code

3.2 | 24 ratings Rate this file 54 Downloads (last 30 days) File Size: 18.6 KB File ID: #4900 Version: 1.0

Huffman code



11 May 2004 (Updated )

Simple Huffman code implementation.

| Watch this File

File Information

This is an implementation of Huffman code. Content:
%NORM2HUFF Huffman codification (encoder)
%HUFF2NORM Huffman codification (decoder)
%HUFFCODES2BIN Convert huffcodes to binary representation

Max codeword length is 51 bits.

MATLAB release MATLAB 6.1 (R12.1)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (34)
10 Feb 2017 Hemanth Naidu Bevara


11 Oct 2016 hongzhi yang


17 Apr 2016 hadia kiran

v nice

Comment only
20 Nov 2013 Jian

Jian (view profile)

thanks very much

12 Dec 2011 Huang Yuanjiang


Comment only
01 Nov 2010 william ?

Thank you!

19 Aug 2010 AMAR

AMAR (view profile)

It works perfectly but only for unsigned data. good work done Thanks

14 May 2009 pingker


Comment only
25 Mar 2009 avinash mitta


ru guys sure if a Matlab program works out a Huffman code for this source.
please help me.....

can u send d file as m file or text...

please help me

Comment only
27 May 2008 Edson Rodrigues

It's great nice job Giuseppe! thank you so mutch...

Comment only
15 Apr 2008 Ketan Agrawal


12 Feb 2008 abhishek karnattak

involve basic programming also...

14 Jan 2008 Mahmoud ahmad

very nice

Comment only
22 Dec 2007 Rodhwan Al-Hetar

thanks,Download Now

17 Apr 2007 ahmet seyit

09 Apr 2007 li quan

have a look

29 Mar 2007 monmon monmon

i like matlab codes

Comment only
20 Feb 2007 shabnam zandesh

06 Nov 2006 RAMZI Allal

I ask for the huffman encode/decode.

Comment only
27 Oct 2006 pook pookie

good very

19 Oct 2006 minh tin

10 Oct 2006 amir suzzia

02 Aug 2006 Jawed Qumar

06 Jul 2006 Amanuel Tadesse

I am student of communication engineering
therefore I am taking acourse on coding theory so let's cooperate.

Comment only
20 Feb 2006 Ketan Agrawal

No comments

25 Jun 2005 george gabra

i want huffman code , because i have some project by it please send it to me in my e-mail if that possible . thank's

19 Jun 2005 mic ed

thank u

18 May 2005 Shoaib Iqbal

22 Mar 2005 Michael Kleder

Works great. Thanks!

21 Jan 2005 chau bao


08 Dec 2004 Aytac Sen

It worked perfectly and fast enough for me. The comment 'worst code i ever saw' is a discouraging comment for this submission! I was hesitating for downloading it, but then I gave it a go and it was a perfect solution. Thanks.

29 Nov 2004 rakesh v

worst code i ever saw

Comment only
02 Jul 2004 Florian Füessl


if you change the following lines of the code this is probably one of the fastest huffman codes for matlab:
--- norm2huff.m ---
% frequency
%f = frequency(vector);
% frequency function is obsolete
% hist function is much, much faster!!!
f = hist( double( vector(:) ), 0:65535 );
f = f/sum(f);

Note: I also updated the script to handle uint16 instead of uint8; so for uint8 maybe try the following hist function: ...hist(...,0:255)

19 May 2004 A B

25 May 2004

New function added: huffcodes2bin.m
% [W,S] = HUFFCODES2BIN(HC) returns the Huffman representation HC returned
% by the function NORM2HUFF to the corresponding binary strings of '0' and '1'

Contact us