%% Interleave and Deinterleave VHT Data Field
% Perform BCC interleaving and deinterleaving for the VHT interleaving type.
%
% Define the input parameters. Set the number of coded bits per OFDM symbol per spatial stream per interleaver block to 52, the channel bandwidth to 20Mhz and the number of spatial streams, named as numSS, to 4.

numCBPSSI = 52;
chanBW = 'CBW20';
numSS = 4;

%
% Create a sequence of bits for two OFDM symbols, four spatial streams, and one segment.

bits = randi([0 1],(2*numCBPSSI),numSS,1);

%
% Perform BCC interleaving on the bits.

intBits = wlanBCCInterleave(bits,'VHT',numCBPSSI,chanBW);

%
% Perform BCC deinterleaving on the interleaved bits.

out = wlanBCCDeinterleave(intBits,'VHT',numCBPSSI,chanBW);

%
% Verify that the deinterleaved data matches the original data.

isequal(bits,out)

% Copyright 2012 The MathWorks, Inc.