LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I get a For loop to display the results of each iteration?

Solved!
Go to solution

Why are you doing all this work inside the loop.  The final result won't be displayed until the loop has finished anyway.  Indexing then splitting then rebuilding the array will take place each loop iteration.  This is very unnecessary.  Just do the indexing after the loop has finished.  Only need to do this once after all the data has been collected.

 

- tbob

Inventor of the WORM Global
Message 11 of 14
(929 Views)

For a few reasons.

 

1. Right now, my data set is only 3k, and the while loop is only doing 3 turns. Doing this outside the Loop creates a 3-D array which needs to be indexed and split and rebuilt. If i'm reading in a data set of over 2m entries, This becomes slow.

2. the dimensions of the 2 D array i'm dealing with are at maximum 4x500 (very managable) the 3D might have dimensions of 4x500x2-5k. Slightly less managable.

3. To get my 4 1D arrays from the 3D array, I would have to split and recombine 12 separate streams, right now i'm only having to do 4, and supposing my data set increases from 3k

3. Each subsequent iteration is being decimated again. my first row starts at 500 samples, next row is 250, etc. yet the remaining 250 or however many until the end are all read as zeros. These 1D arrays all need to be split because only the first (array size)/(2^n) entries are legitimate. If I were to just build the 2D arrays together, I'd have a whole lot of zeros between parts of data that should be continuous.

 

 

 

example: you start with a data set of 16 entries, the 2D array coming out of the For loop looks like

 

1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16

1, 3 ,5, 7, 9, 11, 13, 15, 0, 0, 0, 0, 0, 0, 0, 0

1, 5 ,9, 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ,0

1, 9 ,0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0

 

 

supposing I were to just connect these arrays together, the 4th scale would always have 8x as many blank spaces as acutal data.

0 Kudos
Message 12 of 14
(922 Views)

So is there any way to simplify this diagram? I think the post index process can be done together?

0 Kudos
Message 13 of 14
(907 Views)
Solution
Accepted by topic author Evilduck

Take all your common functions from your 4 different array manipulations, Array Size, X2^N, Split Array, Divide, Build Array, and whatever else is common, and make a subvi with it.  Make the subvi re-entrant.  Use the subvi 4 times with the output of Index Array as the input.  You will have 4 outputs that you can wire to your shift registers.  Anytime you duplicate code, use a subvi.  In this case it needs to be re-entrant because the same subvi will be called 4 times in parallel with different data each time.  By making it re-entrant, each call will have its own memory space for data.

 

- tbob

Inventor of the WORM Global
Message 14 of 14
(899 Views)