01-24-2021 07:00 PM
I have a 1d array of data such as the following
44.8677
44.3500
44.8687
44.8529
44.8688
44.9654
I need these values inserted into an n dimensional matrix for instance 2x3 where the sum of the rows are as equal as possible.
01-24-2021 08:01 PM
Do you have a problem figuring out an algorithm or implementing it in LabVIEW?
What have you tried?
What is the maximum number of elements?
01-25-2021 12:04 AM
I think im close but missing something big. My approach is to randomize the list then put it into a 2x3 array which would then get the differences followed by the largest difference then i wanted to use a shift register or feedback node to do the process again if the next randomized arrays largest difference was smaller then the last it wins. Maybe its late but im stuck.
01-25-2021 01:01 AM
Wouldn't it be logical if you sorted the list from smallest to largest, then filled the 2-D array with the smallest and largest value in the first row, the 2nd largest, 2nd smallest in the 2nd row, and the remaining 2 elements in the 3rd row, that would have the least differences between the sums?
01-28-2021 07:12 PM
works for me!
01-29-2021 11:58 AM - edited 01-29-2021 12:11 PM
@Pohlr1 wrote:
I am glad you solved your problem, but your initial code has serious general flaws that should be mentioned. Hopefully, your final solution is a bit more polished. Feel free to attach it.
Now some comments to the attempt you posted.