LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Group 1d array elements by row

Also, do I not need to change the dimension size of the array that gets initialized into the shift register? 

Asasafuchi_0-1736407087873.png

 

0 Kudos
Message 31 of 36
(152 Views)

Ok I think I solved this problem too but I think I encountered a bug with the interval/distance checking algorithm. It appears to group some elements that clearly dont overlap or are within the max distance. I have attached a vi with input data that exemplifies this issue. 

 

Note that I added an additional double array as input but it can just be ignored as I don't believe this has anything to do with the grouping process.

 

 

0 Kudos
Message 32 of 36
(144 Views)

@Asasafuchi wrote:

Also, what is the purpose of converting from string to ascii index? Would it not work with searching for the character themself?

 


My method only works correctly if we have a consecutive set of well defined characters. The advantage is that is is extremely efficient, but that's irrelevant unless you have hundreds of millions of elements. :D.

0 Kudos
Message 33 of 36
(131 Views)

Hi again,

 

how can I modify the code you provided such that the grouping only happens if all ranges are within the max distance or overlapping? If I understand the code correctly it will group elements in the same row if atleast one of them is within the max distance or overlapping but how could I change it such that each row guarantees that all elements are within the max distance of each other? Could it be done by making a slight adjustment to the grouping logic done after unbundling?

 

Asasafuchi_0-1739953346600.png

 

0 Kudos
Message 34 of 36
(100 Views)

@Asasafuchi wrote:

how can I modify the code you provided such that the grouping only happens if all ranges are within the max distance or overlapping? If I understand the code correctly it will group elements in the same row if atleast one of them is within the max distance or overlapping but how could I change it such that each row guarantees that all elements are within the max distance of each other? Could it be done by making a slight adjustment to the grouping logic done after unbundling?


LabVIEW is a powerful programming language and all reasonable tasks can be done with a little bit of code.

 

However, the first thing is to exactly define the problem and the terms. For example I don't know what "if all ranges are within the max distance or overlapping" even means. Same for the rest of your descriptions above.  Did you ever fix the formatting of the inputs?

 

It might be easier to describe it graphically.

0 Kudos
Message 35 of 36
(71 Views)

Yes, the formatting issues were fixed. Now I just wish to modify it slightly. What I mean if "All ranges are within the max distance is that no elements in the same row should be more than the max distance apart. For example if we consider the array provided in your solution the new output would look like this: 

Asasafuchi_0-1740034863066.png

note how A [150 - 200] and D [80 - 100] no longer get placed in the same row because they are more than the max distance apart from one of the elements in the same row. I made some adjustments to your code and it seems to work but I would still like your input whether or not the solution checks out or if maybe there is an easier fix. 

0 Kudos
Message 36 of 36
(53 Views)