09-05-2005 03:46 AM
09-06-2005 01:16 PM
labmaster,
I'm not sure you understand the reason for the inefficiency of functions like Build Array. Inserting some function at the end of a loop will not make it any more efficient because the problem is that Build Array will still be called every iteration of the loop and the array will be resized at that point. So functions after the build array will have no effect. The best thing to do is to pre-allocate the array somehow. For example, in your case you don't know how big the array needs to be, but one possible solution would be to preallocate an array that you are sure would have enough space to hold the data points. Sure there may be elements that are not used, but LabVIEW wouldn't have to resize the memory space for the array every iteration of the loop. Here is a tutorial that talks about maximizing the efficiency of a LabVIEW program. About 2/3 of the way down it talks about how to avoid constantly resizing data and walks through an example with the build array function. This should help you out some. Good luck and have a great day!
Tyler S.
09-06-2005 01:38 PM
09-06-2005 02:02 PM
09-06-2005 02:06 PM
One more point, if you are doing the array processing in a subvi and need only temporary use (while the subvi is opened) you can have the array explicitly removed from memory using Advanced->Data Manipulation->Memory Deallocation. Good Idea if you are making many repetative calls to a processing subvi which manipulated data in an array
Paul