LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

replace arrary subset is too slow

I find that the function "replace arrary subset" is too slow. Please see the attached VIs. Could some one tell me why? Thanks!
0 Kudos
Message 1 of 3
(2,863 Views)
"Replace array subset" is typically very fast.

Your main problem is the use of global variables inside a loop. I cannot test because I don't have a data file, but the attached modification should speed it up a bit. It limits the constant reading and writing of globals.

You might also consider reading all records outside the loop, replace the while loop with a for loop, and autoindex on the array of records. You should be able to calculate how many records are in the file from the file size.
Message 2 of 3
(2,863 Views)
Reading a global always makes a copy in memory. A brief description why globals inside loops are slow can be found HERE.

You might also want to read the NI application note about LabVIEW Performance and Memory Management.
0 Kudos
Message 3 of 3
(2,863 Views)