gusucode.com > wlan工具箱matlab源码程序 > wlan/wlanexamples/helperFieldLengths.m

    function out = helperFieldLengths(chanBW, format)
%helperFieldLengths Get preamble field lengths for different formats
%
%   STR = helperFieldLengths(CHANBW, FMT) returns the preamble field
%   lengths for the specified channel bandwidth, CHANBW, and transmission
%   format, FMT. Only the fields whose length can be determined based on
%   the channel bandwidth and format are provided.
%
%   STR is a structure with fields storing the individual field lengths.
%   
%   CHANBW must be one of 'CBW20', 'CBW40', 'CBW80', 'CBW160'.
%
%   FMT must be one of 'VHT', 'HT', 'NonHT'.
%
%   Example:
%       str = helperFieldLengths('CBW20', 'VHT')
%
%   See also wlanFieldIndices.

%   Copyright 2016 The MathWorks, Inc.

%#codegen

N20MHz =  wlan.internal.cbwStr2Num(chanBW)/20;
FFTLen = 64 * N20MHz;   % FFT length for 20MHz bandwidth

% Preambles are always long
symLength = FFTLen * 5/4;

% Set up the lengths per field
fLen.LSTF = 2*symLength;
fLen.LLTF = 2*symLength;
fLen.LSIG = symLength;

if strcmp(format, 'VHT')
    fLen.VHTSIGA = 2*symLength;
    fLen.VHTSTF = symLength;
    % VHTLTF length not known, not accounted for SIGB, Data
    out = fLen;
elseif strcmp(format, 'HT')
    fLen.HTSIG = 2*symLength;
    fLen.HTSTF = symLength;
    % HTLTF length not known, not accounted for Data
    out = fLen;
else % assumed NonHT
    % not accounted for Data
    out = fLen;
end

% [EOF]