LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Building and sorting 3d arrays

Hi,

 

Recently I've come across the problem of building and sorting arrays quite a bit and am wondering what is the best way to implement a solution  for both speed and memory efficiency. Take the below illustraion. I wish to concatenate two 3d arrays based on the value of the element in the first row, lets say for instance they are characters. When I attempt a solution in LabVIEW it always gets over complicated very quickly for what seems to me to be a basic enough problem, so maybe some more experienced users have a few pointers?

 

 

 3d array.png

0 Kudos
Message 1 of 2
(2,319 Views)

First let me point out that your example shows an irregular array, which is not allowed in LabVIEW. When I come across the need to use constructs such as this, I usually use a cluster of 2 arrays. The first array in the cluster is a 1d array of my indices, in your case, a 1d array of strings containing {a,b,c}. The second array is a 1d array of clusters. the cluster contains whatever irregular data that I need to be able to find. To use this structure, I unbundle the first array and search for the element that I wish to modify using "Search 1d Array". I then use the index returned from that function to index the second array so I can then modify it. Sounds like a bit of a Rube Goldberg construct but gets the job done...

Charles Chickering
Architecture is art with rules.

...and the rules are more like guidelines
Message 2 of 2
(2,300 Views)