Here is the part of the matlab Code that I was working for an SDR development.

In the following code, when the ind in the for loop below exceeds four or more than

half fo the loop, it stops and gives me an error.

Can someone help me and let me know the reason why it happens in MATLAB.

// The code begins here.

NumFrames =10;

%% Build OFDM Modulator

FFTLength = 64;

NumGuardBandCarriers = [6; 5];

NumDataCarriers = 48;

CyclicPrefixLength = 16;

PilotCarrierIndices = [12;26;40;54];

NumOFDMSymInPreamble = 5;

NumBitsPerCharacter = 7;

SampleRate = 20e6;

Fs = SampleRate;

msgInBits = repmat(randi([0 1], NumDataCarriers, 1),10160, 1);

PayloadBits = msgInBits(:);

MSDU = ceil(length(PayloadBits)/(NumFrames*NumDataCarriers));

txData = zeros(0,1);

for ind = 0 : (NumFrames-1)

framebody = PayloadBits((ind*MSDU*NumDataCarriers)+1:(NumDataCarriers*MSDU)*(ind+1),:);

txData = [txData; framebody];

PayloadBits((ind*MSDU*NumDataCarriers)+1:(NumDataCarriers*MSDU)*(ind+1),:)=[];

if(ind == 4) // When Ind exceeds more than half the loop, it creates error message.

return

end

end

## Best Answer