%% Display Index Mapping of LDPC Code Block Segmentation
% Create a ramp data input and perform code block segmentation.

cbs = nrCodeBlockSegmentLDPC([1:4000]',2);

% The input of length 4000 is split into two code block segments of equal size with 24B CRC and filler bits attached. To see how the input maps onto the output, plot the input data indices relative to the corresponding code block segment indices.

plot(cbs)
legend('CBS1','CBS2')
xlabel('Code Block Bit Indices');
ylabel('Input Data Bit Indices + CRC/Filler');
title('Code Block Segmentation Operation')

% Copyright 2019 The MathWorks, Inc.