cromax Posted November 28, 2008 Report Share Posted November 28, 2008 hello I want to use get xy waveform function with the Aim to get the last value of waveform acquisition. What index i can use in this function? I read in a help that if i don't use any index i get the o component and not the last. It's true? thank you Quote Link to comment
Francois Normandin Posted November 28, 2008 Report Share Posted November 28, 2008 QUOTE (cromax @ Nov 27 2008, 06:42 PM) helloI want to use get xy waveform function with the Aim to get the last value of waveform acquisition. What index i can use in this function? I read in a help that if i don't use any index i get the o component and not the last. It's true? thank you Last index = length - 1 And yes, if you don't wire any index, you'll get the first result (index=0). Quote Link to comment
Neville D Posted November 28, 2008 Report Share Posted November 28, 2008 Should work for XY data as well (without the waveform unbundle).N. Quote Link to comment
cromax Posted November 30, 2008 Author Report Share Posted November 30, 2008 Thank you very much cromax Quote Link to comment
OlivierL Posted December 2, 2008 Report Share Posted December 2, 2008 Thanx NevilleD, That's really neat and faster and more compact than always going with "Index array"("Array Length" -1). I tried it and was surprised to see it working, even if you change the length of it. If you do that, without an index, it takes the "n" last elements in the array. LabVIEW Help file specifies this behavior. Neat! I'll reuse that one for sure. Olivier Quote Link to comment
Francois Normandin Posted December 2, 2008 Report Share Posted December 2, 2008 QUOTE (OlivierL @ Dec 1 2008, 01:00 PM) Thanx NevilleD,That's really neat and faster and more compact than always going with "Index array"("Array Length" -1). I tried it and was surprised to see it working, even if you change the length of it. If you do that, without an index, it takes the "n" last elements in the array. LabVIEW Help file specifies this behavior. Neat! I'll reuse that one for sure. Olivier It is easier, although my benchmarks show it's 3 times slower than the "Index array"("Array Length" -1) way. Averaged on a million operations with 100-element array, using "Delete from Array" resulted in a 7.2us execution time per loop, compared to 2.25us per loop for the "Index Array" method. Actually, other methods are faster too: 0.75 us/loop 0.234 us/loop 0.243 us/loop 0.425 us/loop 1.44us/loopBased solely on execution speed, you should use the IndexArray(Length-1) method... but reversing the array is not bad for a 100-element array. Quote Link to comment
Neville D Posted December 2, 2008 Report Share Posted December 2, 2008 QUOTE (normandinf @ Dec 1 2008, 12:57 PM) It is easier, although my benchmarks show it's 3 times slower than the "Index array"("Array Length" -1) way. Averaged on a million operations with 100-element array, using "Delete from Array" resulted in a 7.2us execution time per loop, compared to 2.25us per loop for the "Index Array" method. Actually, other methods are faster too:Based solely on execution speed, you should use the IndexArray(Length-1) method... but reversing the array is not bad for a 100-element array. Sure, its the lazy programmer's way to get at the final element. It also conserves valuable block diagram space; and with multi-core processors, it shouldn't make too much of a difference. That being said, if I want a routine to be really fast, I use the Index array with (N-1) as input. It might be slower because a buffer might need to be allocated for the remaining N-1 element array. Did you have that wired as well? Neville. Quote Link to comment
Francois Normandin Posted December 2, 2008 Report Share Posted December 2, 2008 QUOTE (Neville D @ Dec 1 2008, 04:16 PM) It might be slower because a buffer might need to be allocated for the remaining N-1 element array. Did you have that wired as well? There were no difference (or sub microsecond) for unwired index or 0-wired. And I totally agree with your usage assessment. I, too, am lazy most the time... EDIT: I didn't try wiring the DeleteArray index with (length-1)... (If we did, then the output changes from Scalar to Array) Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.