Hello Greg,
Yes I did not put the entire code, for instance there is (before the loop):
n0=length(M);
Ndelay=1000;
As the brut-force is very slow I don't do it for all possible delays.
Otherwise, yes I'm new here as you said, please tell me if I am doing something wrong.
Thank you,
Antoine