adityabvmk
Junior Member level 2

can anybody please give the code for huffman coding in matlab....
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Huffman Code is very easy..can anybody please give the code for huffman coding in matlab....
actually i want the code not the inbuilt function in matlab....thanks for reply
clc;
clear all;
close all;
sig=1:4;
Symbols=[1 2 3 4];
P=[0.1 0.3 0.4 0.2];
dict = huffmandict(Symbols,P);
temp=dict;
for i=1: length(temp)
temp {i,2}= num2str(temp{i,2});
end
disp(temp);
hcode= huffmanenco(sig,dict)
dhsig= huffmandeco(hcode, dict)
I think this will work.........
Code:clc; clear all; close all; sig=1:4; Symbols=[1 2 3 4]; P=[0.1 0.3 0.4 0.2]; dict = huffmandict(Symbols,P); temp=dict; for i=1: length(temp) temp {i,2}= num2str(temp{i,2}); end disp(temp); hcode= huffmanenco(sig,dict) dhsig= huffmandeco(hcode, dict)