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.
01-08-2025 01:50 AM
I am trying to repurpose code given by altenbach that groups a 1d array into a 2d array such that it can handle a new input consisting of a 2d array and 1d arrray providing the same output. The 2D array will contain the same elements as the previous 1D array but in different locations. The 1d array will contain the column index which the element should be placed in. As seen in the figure, the column starting index. The elements that appear in the same row are grouped if the letter matches and if their intervals overlap or are within the max distance. The input will always be letter [starting point - end point].
I have attached the vi that handles the 1d case with the new example inputs. I am sure there is an easy way to solve it but I just cant figure out how.
01-08-2025 10:40 AM
Ok I think I solved it, however I would like to change the first bundling process such that it does not rely on the input being an uppercase letter and can handle words. Is there an easy way to change the bundling algorithm such that it checks the entire word and not just the first character? Because right now it will group if the first character is a match.
01-08-2025 11:18 AM - edited 01-08-2025 11:19 AM
Sorry, I've been without power since last evening. No computer access.
Parsing the string should be easy, e.g. just find the "[" and go from there.
01-09-2025 01:12 AM
No worries 🙂
Could I not just replace the string to unsigned bit array with a match regular expression, looking for the brackets and then use that to find the index? Also, what is the purpose of converting from string to ascii index? Would it not work with searching for the character themself?