# [✓] Create a loop to compute the minimum?

GROUPS:
 I have a long data (795,000 rows). For every 5000 rows I need the minimum and the position of this minimum. Then I will get 159 minima with their positions. I tried to create a loop to calculate these minima, but I didn't find a correct way. If my data is dd What should I do to correct this mini[i_] := Min[dd[[i ;; i + 5000]]] pos[i_] := Position[dd, mini[[i]]] minima = {} For[i = 1, i <= Length[dd], i + 5000, AppendTo[minima, {mini[[i]], pos[[i]]}]] Thanks in advance.
Answer
5 months ago
3 Replies
 . dd = {Insert Your 795000 Numbers Here}; part = -1; Map[(part++; pos=Ordering[#,1]; Flatten[{#[[pos]], part*5000+pos}])&, Partition[dd,5000]] 
Answer
5 months ago
 Thank you for your help! I tried to use your command, but my data has specific numbers. It is the result of another code that computes the differential cross sections, so do you think I can use RandomReal.? I should get stable values of the minima.
Answer
5 months ago
 I really appreciate it. I got what I need.Thanks a lot!
Answer
5 months ago