function ifftin = generateOFDMSymbol(txgrid, info, genb)
%% Index of first subcarrier in IFFT input
Nfft           = info.Nfft;
NDLRB          = genb.NDLRB;
SymbolsPerSlot = info.SymbolsPerSlot;
includezsc     = ~(isfield(genb,'UseDCSubcarrier') && strcmpi(genb.UseDCSubcarrier,'Off'));
nSC            = NDLRB*12;
firstSC        = (Nfft/2) - (NDLRB*6) + 1;
nAnts          = size(txgrid,3);
nSubframes     = floor(size(txgrid,2)/(SymbolsPerSlot*2));
ifftin         = [];
for i = 1:nSubframes*SymbolsPerSlot*2
    if (size(txgrid,1)==Nfft)
        ofdmSymbol = squeeze(txgrid(:,i,:));
    else
        ofdmSymbol = zeros(Nfft,nAnts);
        ofdmSymbol(firstSC+(0:nSC/2-1),:) = txgrid(1:nSC/2,i,:);
        ofdmSymbol(firstSC+nSC/2+(includezsc==0)+(0:nSC/2-1),:) = txgrid(nSC/2+1:end,i,:);
    end
    ifftin = [ifftin, fftshift(ofdmSymbol)]; %#ok<AGROW>
end
end