%% DCI Decoding Using Channel Structure
% Perform DCI decoding of a sample codeword and return the decoded vector, decodedDCIbits, of the length defined for the DCI Format 2A message.

enb.NDLRB = 25;
enb.CellRefP = 1;
enb.DuplexMode = 'FDD';

dciInfo = lteDCIInfo(enb);
dcilen = dciInfo.Format2A

ue.PDCCHFormat = 2;
ue.RNTI = 5;
ue.NDLRB = 25;

dciBits = zeros(dcilen,1);
cw = lteDCIEncode(ue,dciBits);

%
% Define the ue-specific configuration structure, chs, for recovery of the DCI message and RNTI. Perform DCI decoding using enb and chs.

chs.DCIFormat = 'Format2A';
chs.ControlChannelType  = 'PDCCH';
chs.EnableCarrierIndication  = 'Off';

[decodedDCIbits,crcRNTI] = lteDCIDecode(enb,chs,cw);

decodedDCIbitslen = size(decodedDCIbits)
crcRNTI

% The decodedDCIbits length matches the value of dcilen. The crcRNTI value recovered corresponds to and matches ue.RNTI, which is the RNTI value used in the CRC masking.
% Copyright 2012 The MathWorks, Inc.