%% Create DCI Bit Message
% Create a format 1A DCI message structure and output the bitsout message. Modify the DCI message and observe the change.
% Create cell-wide settings and DCI message settings structures. For the DCI message, assign format 1A and allocation type 0. Generate the DCI message. View the DCI message structure and bits output.

enb = struct('NDLRB',25,'CellRefP',1,'DuplexMode','FDD');
dciin = struct('DCIFormat','Format1A','AllocationType',0);

[dciout,bitsout] = lteDCI(enb,dciin);

dciout
bitsout'

% The first bit in bitsout is a 1 for DCI message format 1A. The second bit is 0 for AllocationType = 0.
%
% Modify the allocation type to 1. Regenerate the DCI message. View the DCI message structure and bits output.

dciin = struct('DCIFormat','Format1A','AllocationType',1);

[dciout,bitsout] = lteDCI(enb,dciin);

dciout
bitsout'

% Note the AllocationType and the second bit of bitsout both changed from 0 to 1.
%
% Modify the DCI message format to 0. Regenerate the DCI message. View the DCI message structure and bits output.

dciin = struct('DCIFormat','Format0','AllocationType',1);

[dciout,bitsout] = lteDCI(enb,dciin);

dciout
bitsout'

% The first bit in bitsout change from 1 to 0. Because the message formats 0 and 1A have the same length, the first bit in bitsout is used to distinguish these formats. For all other formats, the message length is used to distinguish the format types. For format 0, the setting for AllocationType is specified by bit number 24.
% Copyright 2012 The MathWorks, Inc.