%% Create and Decode SL-SCH Codeword
% Use the physical channel bit capacity information to configure the output codeword size for SL-SCH coding. Decode the resulting codeword and check for CRC errors.

ue = struct('NSLRB',50,'CyclicPrefixSL','Normal');
ue.PRBSet = (10:12)';
ue.Modulation = '16QAM';
ue.RV = 0;

[~,psschinfo] = ltePSSCHIndices(ue);
cwlength = psschinfo.G;

trblk = randi([0 1],100,1);
cw = lteSLSCH(ue,cwlength,trblk);
[rxtrblk,err] = lteSLSCHDecode(ue,length(trblk),cw);
err

% The transport block is recovered with no error.
% Copyright 2012 The MathWorks, Inc.