Jsmidlow 1 Posted July 19, 2021 (edited) Hello. I have an array attribute and I need to figure out min values among all first, second, third, etc elements of arrays. If I were about to know the exact length of array (let's say 3) I would do this... iterate insider forloop "distances" append values to three new arrays and find min values with min function. min(distancesone[0]), min(distancestwo[1]), min(distancesthree[2])...... My problem is that I don't know the exact number of array and min() is useless as long as I can't manually create arrays of specific number elements. So the question is how can I figure put the min value among distances[0] elements, then [1], [2] and so on... Thank you. Edited July 19, 2021 by Jsmidlow Share this post Link to post Share on other sites
Dweeble 8 Posted July 19, 2021 (edited) for( int i = 0; i<detail(0, 'arrlen', 0); i++ ) { float arr[]; for( int j =0; j<npoints(0); j++ ) { float arr_val[] = point(0, 'distances', j); if (len(arr_val)>i) append(arr, arr_val[i]); } append(f[]@mins, min(arr)); } Like this? In a detail wrangle you'd get a detail array attribute where each element is the smallest value at that index of 'distances'. You can get the length of longest array with attrib promote beforehand. Edit: code quote thing was weird Edited July 19, 2021 by Dweeble Share this post Link to post Share on other sites