%% Determine Vector Quantizer Codeword
% Note: This example runs only in R2016b or later. If you are using an earlier release, replace each call to the function with the equivalent step syntax. For example, myObject(x) becomes step(myObject,x).
% Given index values as an input, determine the corresponding vector quantized codewords for a specified codebook.

vqdec = dsp.VectorQuantizerDecoder;
vqdec.Codebook = [1 10 100;2 20 200;3 30 300];
indices = uint8([1 0 2 0]);
qout = vqdec(indices)

% Copyright 2012 The MathWorks, Inc.