10-14-2015 07:41 AM
Hi all.
Usually, the best way to create an array is to use Initalize Array and replace elements using a while loop and a shift register, as reported here:
But... if I want to create an array of waveforms? I think that it should not the better method (from the point of view of performance).
A waveform contains several elements, in particular it contains an array of double (Y array).
So, what happen if I apply the code above with waveform (see the following figure)?
The Initialize Array function allocates a certain amount of memory for my array. The waveform used to initalize the array contains a empty array of data (Y array is empty). When the i-element is replaced in the array, the Y array is not empty and LabVIEW should allocate new memory for it. Am I right?
If my argument is correct, in this case does the auto-indexing with a for loop should be preferred rather than the previous method?
Thanks
10-14-2015 07:56 AM
Have you tried to keep it simple,
Am not an expert on memory allocations but the posted example may be worth of consideration for simplicity's sake.
10-14-2015 08:27 AM
I think in this case OP is talking about replacing some elements in the array, so pre-allocating that to the maximum array size then doing a replace is the most efficient. The example is probably simplified.
That being said OP can try something like this, which will preallocate 100 waveforms with 1000 points in each.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord