LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

speed of array calculation.

Solved!
Go to solution

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?

 

 

Message Edited by labmaster on 05-25-2009 03:18 PM
Download All
0 Kudos
Message 1 of 7
(3,119 Views)

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?

0 Kudos
Message 2 of 7
(3,093 Views)

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.

-Matt Bradley

************ kudos always appreciated, but only when deserved **************************




0 Kudos
Message 3 of 7
(3,092 Views)
There is no "division" in the attached VI. I believe the OP talked about splitting an array into two parts.
0 Kudos
Message 4 of 7
(3,077 Views)
I see... couldn't figure it out from the .jpg image and couldn't load the vi.  Sorry about that.
-Matt Bradley

************ kudos always appreciated, but only when deserved **************************




0 Kudos
Message 5 of 7
(3,074 Views)
Solution
Accepted by topic author labmaster

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.

0 Kudos
Message 6 of 7
(3,062 Views)

Thank you so much.

I will change my other codes.

 

labmaster.

0 Kudos
Message 7 of 7
(3,016 Views)