%% Generate HT-Format A-MPDU
% Generate a high-throughput-format (HT-format) A-MPDU frame of length 5000 octets.
% Create a MAC frame configuration object.

 cfgMAC = wlanMACFrameConfig('FrameType','QoS Data', ...
     'FrameFormat','HT-Mixed', ...
     'MPDUAggregation', true);

%  Create an HT-format configuration object.

cfgPHY = wlanHTConfig('MCS',4);  

% Calculate the MSDU lengths required to generate a 5000-octet A-MPDU frame, displaying the result.

msduLengths = wlanMSDULengths(5000,cfgMAC,cfgPHY);
disp(msduLengths)

% Create MSDUs with random data using the obtained MSDU length vector.

 numMSDUs = numel(msduLengths);
 msduList = cell(1,numMSDUs);
  for i = 1:numMSDUs
      msduList{i} = randi([0 255],1,msduLengths(i));
  end

% Generate the 5000-octet A-MPDU.

[frame,frameLength] = wlanMACFrame(msduList,cfgMAC,cfgPHY);
disp(frameLength)

% Copyright 2018 The MathWorks, Inc.