%% Demodulate DMG-Data Field and Get OFDM Information
% Perform OFDM demodulation on the DMG-Data field, then extract the data and pilot subcarriers.
% Generate a WLAN waveform for a DMG transmission, specifying the modulation and coding scheme (MCS).

cfg = wlanDMGConfig('MCS','15');
bits = [1; 0; 0; 1];
waveform = wlanWaveformGenerator(bits,cfg);

% Obtain the field indices and extract the DMG-Data field.

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

% Perform OFDM demodulation on the DMG-Data field.

sym = wlanDMGOFDMDemodulate(rx);

% Get the OFDM information, then extract the data and pilot subcarriers.

info = wlanDMGOFDMInfo;
data = sym(info.DataIndices,:,:);
pilots =  sym(info.PilotIndices,:,:);

% Copyright 2018 The MathWorks, Inc.