Maximum recursion limit of 500 reached problem

Hello, I have this error
Error evaluating 'PreLoadFcn' callback of block_diagram.
Caused by:
Maximum recursion limit of 500 reached.
preload fun:
commlteSystem_params;
[prmLTEPDSCH, prmLTEDLSCH, prmMdl] = commlteSystem_initialize(txMode, ...
chanBW, contReg, modType, Eqmode,numTx, numRx,cRate,maxIter, fullDecode,chanMdl, Doppler, corrLvl, ...
chEstOn, numCodeWords, enPMIfback, cbIdx);
clear txMode chanBW contReg modType Eqmode numTx numRx cRate maxIter fullDecode chanMdl Doppler corrLvl chEstOn numCodeWords enPMIfback cbIdx
and commlteSystem_params script:
% Script for LTE (mode 1 to 4, downlink transmission)
%
% Single or double codeword transmission for mode 4
%
commlteSystem_params;
[prmLTEPDSCH, prmLTEDLSCH, prmMdl] = commlteSystem_initialize(txMode, ...
chanBW, contReg, modType, Eqmode,numTx, numRx,cRate,maxIter, fullDecode,chanMdl, Doppler, corrLvl, ...
chEstOn, numCodeWords, enPMIfback, cbIdx);
clear txMode chanBW contReg modType Eqmode numTx numRx cRate maxIter
fullDecode chanMdl Doppler corrLvl chEstOn numCodeWords enPMIfback cbIdx
disp('Simulating the LTE Downlink - Modes 1 to 4');
zReport_data_rate_average(prmLTEPDSCH, prmLTEDLSCH);
hPBer = comm.ErrorRate;
%%Simulation loop
tic;
SubFrame =0;
nS = 0; % Slot number, one of [0:2:18]
Measures = zeros(3,1); %initialize BER output
while (Measures(3) < maxNumBits) && (Measures(2) < maxNumErrs)
%%Transmitter
[txSig, csr, dataIn] = commlteSystem_Tx(nS, prmLTEDLSCH, prmLTEPDSCH, prmMdl);
%%Channel model
[rxSig, chPathG, ~] =commlteSystem_Channel(txSig, snrdB, prmLTEPDSCH, prmMdl );
%%Receiver
nVar=(10.^(0.1.*(-snrdB)))*ones(1,size(rxSig,2));
[dataOut, dataRx, yRec] = commlteSystem_Rx(nS, csr, rxSig, chPathG, nVar, ...
prmLTEDLSCH, prmLTEPDSCH, prmMdl);
%%Calculate bit errors
Measures = step(hPBer, dataIn, dataOut);
%%Visualize results
if (visualsOn && prmLTEPDSCH.Eqmode~=3)
zVisualize( prmLTEPDSCH, txSig, rxSig, yRec, dataRx, csr, nS);
end
fprintf(1,'Subframe no.%4d ; BER = %g \r', SubFrame, Measures(1));
%%Update subframe number
nS = nS + 2; if nS > 19, nS = mod(nS, 20); end
SubFrame =SubFrame +1;
end
toc;
What should i do to prevent this error from happening? Thanks in advance.

 Akzeptierte Antwort

Walter Roberson
Walter Roberson am 28 Apr. 2018

2 Stimmen

You have indicated that your commlteSystem_params script starts with
% Script for LTE (mode 1 to 4, downlink transmission)
%
% Single or double codeword transmission for mode 4
%
commlteSystem_params;
[prmLTEPDSCH, prmLTEDLSCH, prmMdl] = commlteSystem_initialize(txMode, ...
chanBW, contReg, modType, Eqmode,numTx, numRx,cRate,maxIter, fullDecode,chanMdl, Doppler, corrLvl, ...
chEstOn, numCodeWords, enPMIfback, cbIdx);
Notice that the first executable thing it does is call commlteSystem_params which is the exact script that is running. Your script calls itself.

Weitere Antworten (1)

Ameer Hamza
Ameer Hamza am 28 Apr. 2018

0 Stimmen

This happens when you are recursively calling your function to the very deep level of recursion. Although it is better to re-design you algorithm to reduce recursion, if that is impossible you can increase the limit using
set(0, 'RecursionLimit', 1000);

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by