%% Demodulate HE-LTF for RUs in HE MU Waveform
% Demodulate the HE-LTF for each RU in an HE MU waveform.
% Create a WLAN HE-MU-format configuration object, specifying the allocation index, HE-LTF type, and guard interval.

AllocationIndex = 16;
cfg = wlanHEMUConfig(16,'HELTFType',2,'GuardInterval',1.6);

% Generate a waveform for the specified information bits and format configuration object.

bits = [1; 0; 0; 1];
waveform = wlanWaveformGenerator(bits,cfg);

% Generate field indices and extract the HE-LTF.

ind = wlanFieldIndices(cfg);
rx = waveform(ind.HELTF(1):ind.HELTF(2),:);

% Demodulate the HE-LTF for each RU and display the size of the array containing the demodulated symbols in each case.

info = ruInfo(cfg);
allRUs = info.NumRUs;
for ruNumber = 1:allRUs
    sym = wlanHEDemodulate(rx,'HE-LTF',cfg,ruNumber);
    disp(size(sym));
end

% Copyright 2018 The MathWorks, Inc.