title: how can i code and then decode quantized channels using huffman coding?
body: <p>I have to implement a compression scheme.i have quantized the image 's 3 channels using the following commands:</p>
  
  <pre><code>yce = blockproc(y, [8 8], @(block_struct) round(round(block_struct.data) ./ q_y));
  cbce = blockproc(cb, [8 8], @(block_struct) round(round(block_struct.data) ./ q_c));
  crce = blockproc(cr, [8 8], @(block_struct) round(round(block_struct.data) ./ q_c));
  </code></pre>
  
  <p>now i want to code each element above using huffman coding,and then perform the inverse operation.this is my code:</p>
  
  <pre><code>Z = unique (yce); 
  
  countElY=histc(yce,Z);
  
  p = countElY/numel(yce);
  
  [dict,avglen] = huffmandict(Z,p);
  
  K=unique(cbce);
  
  countelcb=histc(cbce,K);
  
  p1=countelcb/numel(cbce);
  
  [dict1,avglen1]=huffmandict(K,p1);
  
  L=unique(crce);
  
  countelcr=histc(crce,L);
  
  p2=countelcr/numel(crce);
  
  [dict2,avglen2]=huffmandict(L,p2);
  
  comp= huffmanenco(yce,dict);
  
  comp1=huffmanenco(cbce,dict1);
  
  comp2=huffmanenco(crce,dict2);
  
  huffman_code = (cat(3,comp,comp1,comp2));
  
  Im1 = huffmandeco(comp,dict);
  
  im2=huffmandeco(comp1,dict1);
  
  im3=huffmandeco(comp2,dict2);
  </code></pre>
  
  <p>I get the following error:</p>
  
  <pre><code>The probability input must be a vector.
  </code></pre>
  
  <p>Can you please help me in this step?thanks in advance</p>