キャンセル
次の結果を表示 
次の代わりに検索 
もしかして: 

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 件の賞賛
メッセージ1/5
2,854件の閲覧回数

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 件の賞賛
メッセージ2/5
2,852件の閲覧回数

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



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 件の賞賛
メッセージ3/5
2,829件の閲覧回数

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 件の賞賛
メッセージ4/5
2,820件の閲覧回数

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 件の賞賛
メッセージ5/5
2,802件の閲覧回数