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.
Never thought of that, but it would indeed be a nice idea.....
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.
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.
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.
I realized I never did an illustration for the conditional concating. Here's how it could look, compared to the existing situation:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.