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!
01-02-2025 12:01 PM
Yes, I tried your idea by adding a new 1d array containing each elements original column index but I couldnt successfully implement it. At any rate, here is an example VI containing the new inputs and outputs with default values. Sorry for the confusion.
01-03-2025 01:28 PM - edited 01-03-2025 01:32 PM
It seems you changed the format, because now there is no space after the first letter. How much variation do you expect in the formatting?
It still does not make sense to have a distance that is orange. It is an integer.
01-04-2025 02:15 PM
You are right, there should be a space between the letters and the brackets. This was just an oversight on my part, no variation in the input will exist so hardcoding the scan from string like you did will still work. I have attached the same vi but with spaces added.