05-25-2009 03:17 PM - edited 05-25-2009 03:18 PM
I met a great problem in data acquisition using producer and consumer loops (two while loop).
I intend to check the acquired data in real time.
To do so, I have to take a manipulation of array by attachment.
(Simply, Attachment did divide two 2D array in considering the direction of acquisition.)
For an 250*250 array, it takes 200msec. This bring to a buffer overrun in enqueue in producer loop.
Would you please recommend more advanced technique to reduce this total time?
Solved! Go to Solution.
05-25-2009 05:32 PM
If performance matters, never use "delete from array" and "insert into array" inside a loop. Whenever you change the size of an array, a new allocation needs to be made in memory. Do everything "in place", e.g. using "index array" and "replace array subset".
Can you explain in simple terms what the algorithm is supposed to do?
05-25-2009 05:34 PM
Actually, if I understand you right, there is a very easy way to do this.
Just use a divide node hooked up to both arrays. The output will be an array where each element will be divided (not a matrix divide).
It should be very fast.
05-25-2009 07:28 PM
05-25-2009 07:31 PM
05-25-2009 08:33 PM
labmaster wrote:For an 250*250 array, it takes 200msec.
Try the following (LabVIEW 8.6). It does a 250x250 in about a millisecond.
(For larger inputs, the saving are even more dramatic. For example it processes a 1000x1000 array in 50ms, while yours takes about 17000ms).
This is just a rough draft. I am sure it could be further inproved. Please verify correct operations.
05-26-2009 10:38 AM
Thank you so much.
I will change my other codes.
labmaster.