LabVIEW Idea Exchange

cancel
Showing results for 
Search instead for 
Did you mean: 
tst

Add a "Concatenate Indexing" option for arrays leaving loops

Status: Completed
Available in LabVIEW 2012

When an array leaves a loop with indexing enabled, you get an array which has one more dimension, but quite often you want to concatenate the data to an array with the same number of dimensions.

 

If the subarrays have the same length, you can use reshape array, but usually they don't and you need to do something like below.

 

It would be very useful if output tunnels for arrays had an "Enable Concatenate Indexing" option as well, as depicted below, which would do this.

 

 Concat Indexing.PNG

 


___________________
Try to take over the world!
24 Comments
Intaris
Proven Zealot

Never thought of that, but it would indeed be a nice idea.....

 

Shane.

tst
Knight of NI Knight of NI
Knight of NI

Even better, if NI combines this with conditional auto-indexing, the tunnel would also have a boolean input which would determine whether the current array gets appended or not. This would be equivalent to placing a case structure around the Build Array primitive in the above picture.

 

 


___________________
Try to take over the world!
Intaris
Proven Zealot

Tst,

 

this would mean the boolean would toggle between "concatenate" and simply outputting the last iteration.  If it switches between concatenation and indexing then the output datatype is dependent on the state of the boolean which can only be determined at run-time....  I don't see how that would work.

 

Shane.

tst
Knight of NI Knight of NI
Knight of NI

this would mean the boolean would toggle between "concatenate" and simply outputting the last iteration.


No, my intention was that the boolean value wired into the input will determine whether the subarray IN THE CURRENT ITERATION will be appended or not (assuming you've enabled concat indexing at edit time). As I mentioned, this would be equivalent to placing a case structure around the Build Array primitive in the above picture.

 

This is a very common use case when concating arrays, because you often don't want the values from every iteration of the loop, but only from iterations that fulfill a certain condition.


___________________
Try to take over the world!
tst
Knight of NI Knight of NI
Knight of NI

I realized I never did an illustration for the conditional concating. Here's how it could look, compared to the existing situation:

 

Conditional concat.PNG


___________________
Try to take over the world!
Tom_Hawkins
Member
I don't like this. It would add another possible behaviour for loop terminals, completely different from current possible behaviours for loop terminals, that new users would have to get to grips with before they could understand simple LabVIEW programs. I don't think the minor saving in time and diagram space is worth it.
Manzolli
Active Participant
Nice idea. I would like a terminal that I can differentiate better from the current automatic indexer.
André Manzolli

Mechanical Engineer
Certified LabVIEW Developer - CLD
LabVIEW Champion
Curitiba - PR - Brazil
CrystalTech
Member
I like this idea since I use looped arrays in much of my code.  I think the graphic indication needs to be a bit larger and distinctive from the normal dimentional array.  However, I think this is a major time and space saver.  Great Idea!
FlamingYawn
Member
I love it!  This would be useful for while loops as well.
Robert Mortensen
CLA, CLED, LabVIEW Champion, Principal Systems Engineer, Testeract
Chris_Koci
Member
Another big advantage to this is rather than potentially allocating new memory each time the build array primitive is called in the for loop, new memory can be allocated only one time once the for loop has finished executing and the final array size is known.