I'm having issues with a MATLAB script, which calculates the coherency between each channel of a nChannXnSamples signal (thus obtaining nFreqSamplesXnChannXnChann)
For that issue I'm using two nested loops (one for each of the last two dimensions) and using the scripts from EEGLAB for calculating the cross correlation.
The issue is that this scripts make my system to freeze, having to restart it pressing the power button.
What surprises me, is that when I debug the script line-by-line using breakpoints, the function runs perfectly until the end.
To sum up, the function only fails (freezing my system) when it runs completely by itself, if I pause it randomly, it is less likely to produce that failure.
Ps: I have tried to use the function pause every 10 iterations, but it doesn't work.
Ps2: The issue persist on MATLAB 2021a and 2019a