12-27-2024 11:15 AM - edited 12-27-2024 11:15 AM
@Asasafuchi wrote:
Thanks! This seems to work and is definitely more clear than my code. However I do have a follow up question: If instead my input was a 2D array with the following format:
This is not clear at all, because in the original problem we create multiple columns from one row. If the input has multiple columns, but each row only occupies one of the columns, how exactly should groups be arranged. It seems unusual if both conditions can be fulfilled.
Can you give an example with more input fields?
In any case, you could just add an additional item that indicates the original column to the intermediary cluster and use that to place the elements at the very end into a 2D array of the correct size. Should be quite a trivial change to my code.
12-30-2024 01:21 PM
So the objective is the same: append elements of the same type (same letter and interval requirement fulfilled) but the difference is that the input will be a 2d array instead of a 1d array. The grouping logic should be as follows: if an element belongs to the same group as another it should be appended to the row of the first occurence of this group type, for example: A[0-10] and A[20-40] are the same, A[20-40] gets appended to the row of A[0-10] because A[0-10] comes first and it gets appended to the second column because that was its original place. The input array will be structured such that each column only contains unique elements, so grouping them would mean only moving the row index of one element to another (notice how column 1 only contains elements of different groups).
12-30-2024 01:51 PM - edited 12-30-2024 01:53 PM
So did you try my idea?
If you want help, make my life easier and attach a simple VI containing the new inputs and desired outputs as default values. (No code, except for the terminals).
It is a waste of my time trying to read text from a screenshot and there are possibilities for typos!