Hoyer Posted May 21, 2020 Share Posted May 21, 2020 I have two arrays, which are filled with values every time when a specific event happens. The first item of the first array corresponds to the first item of the other array, e.t.c... I want to determine where the minimum value of the first array is, and pick the value of the corresponding item from the other array. I guess I should use filter and min commands together, but I suppose there would be a simpler solution. Maybe I could simply get the index of the minimum value and simply pick the same index from the other. How can I do that? Thank you in advance! Hoyer Quote Link to comment Share on other sites More sharing options...
AzeoTech Posted May 21, 2020 Share Posted May 21, 2020 The trick to that is to use the time portion of the array to store the index. Let's assume the arrays are arr1 and arr2: arr1 = insertTime(arr1,0,1) Then, to get the index of the minimum, just do gettime() on that minimum: private theMin = min(arr1) private indexMin = getTime(theMin) Now you can just index into arr2 using indexMin. Min() and Max(), in addition to returning the appropriate value, stick the time of that value into the time portion of the result. Quote Link to comment Share on other sites More sharing options...
Hoyer Posted May 21, 2020 Author Share Posted May 21, 2020 Thank you for the quick answer! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.