hi siko...thank for answer
https://pastebin.com/Vz7s4hbn
Good to see the full code, now I know there is little hope for an easy vectorization to avoid the loop.
The important part was missing in your previous example. The mean loop dependency is:
maxRel = some_val;
% ...
for gg = start:end
% ...
maxRel = max(new_val, maxRel);
% ...
endfor
And similar things for minRel and so on. Thus in each inner loop the value of "maxRel" depends on the outcome of the previous loop.
I have no insight if this is really necessary. You might overthink your code or other followers of this mailing-list for sure have better ideas than I have ;-)
Best,
Kai