LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to: Collect different length 1D-arrays at a tunnel of a while loop.?

Hi,
 
I'm working on a analysis program where I have an inner loop with all calculations and an outer loop collecting the results and finally an presentation.
The problem is that the number of output from the inner loop variats and when the different length 1D-arrays is collected at an tunnel of the outer While loop is LabVIEW adding some "false" zero's the colloms where there less the max munber of results.
 
I have attaced a small example, where the inner loop generates between 98 and 101 results that are collected on a outer loop, in two different way: using a indexed tunnel and using a shift register.
 
The shift register works perfect, but I hope there is a more simple solution (something like "Concatenate input" for a tunnel?), as the shift register uses a lot of room on the block diagram and needs to be initilized and I will need about 24 of those in my application.
 
 
 
 
0 Kudos
Message 1 of 5
(2,741 Views)
I'll be the first of probably many to tell you that a shift register is your best friend, no matter how much space it may take.
0 Kudos
Message 2 of 5
(2,738 Views)

Shift registers are the way to go,  you might use a functional global with the shift registers in that if you are worring about keeping the code clean (this avoids the wiring pass through wires in unused casesof a case structure and can have all shift registers in one subvi and not exposed in the main vi).  I have asked for a concatinating autoindexer in the past (as well as a conditional one) but none have been added.  How big is the data set you are building? 

 

Paul

Paul Falkenstein
Coleman Technologies Inc.
CLA, CPI, AIA-Vision
Labview 4.0- 2013, RT, Vision, FPGA
0 Kudos
Message 3 of 5
(2,734 Views)

First of all, your "complicated" solution is overly complicated, you only need one "concatenate array", not two. 🙂

Another possibility is a feedback node. Since you are using a recent labview version, you can move the initializer terminal to the outermost loop (not available in older versions).

In any case, you are really thrashing the memory with constant reallocations. It might be more efficient to preallocate a "worst case scenario" sized array, replace elements as you go, and trim at the end to the final size.



Message Edited by altenbach on 02-12-2008 08:11 AM
Download All
0 Kudos
Message 4 of 5
(2,728 Views)

Thanks for the answers!

OK, I need only one "concatenate array", that helps a lot! Smiley Surprised and the version with the feedback node looks very easy.

The inner loop in my applications runs between 299 and 301 times and the output is 27 arrays with results that needs to be collected correct without extra zeroes and the outer loop runs 10 times.

 

0 Kudos
Message 5 of 5
(2,713 Views)