%% DCI Decoding
% Perform DCI decoding of a sample codeword and return the decoded vector, decodedDCIbits, of the length defined for the DCI Format 1 message.

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

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

ue.PDCCHFormat = 1;
ue.RNTI = 10;
ue.NDLRB = 50;

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

[decodedDCIbits,crcRNTI] = lteDCIDecode(dcilen,cw);

decodedDCIbitslen = size(decodedDCIbits)
crcRNTI

% The decodedDCIbits length matches the value of dcilen. The crcRNTI output has a value of 10, corresponding to the RNTI values used in CRC masking.
% Copyright 2012 The MathWorks, Inc.