LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Slow array VI

I have created a small VI that has to search 210000 data points.

 

Using a for loop, starting at the first point and selecting a sub array of the next 700 data points and then I return the minimum value from this subarray and I then write this value to a blank array (minimum number array) via a shift register.  Next I move forward 1 point and create a new subarray from this data point forward 700 points and then return the minimum point from this subarray and write this value to the minimum number array via the shift register.

 

Once I have done this 210 000 times I then get the maximum number from my minimum number array.

 

This array takes 10 minutes to run, can I speed this up?

0 Kudos
Message 1 of 5
(2,207 Views)

Hi R_ATS,

 

it takes ~300ms for me (including data generation!):

check.png

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 5
(2,205 Views)

I was getting around 360-380ms from Gerd's code.  I and getting around 350-375 with this code.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 3 of 5
(2,182 Views)

Hi,

 

         You can save array comparisons if check the values with index i-1 and i+700.

 

Best Regards,

Luis A. Mata C.
Ing. Electrónico
Whatsapp: +58-414-1985579
BBM Pin: 2B83E99A
Thanks: Kudos
0 Kudos
Message 4 of 5
(2,173 Views)

Instead of taking slices (sub arrays) of the original array to work on I thought you could take one initial slice and use smart indexing to replace the element as it loops.

I seem to be getting a consistant 168 on this version...

 

Subarray.png

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