05-03-2017 12:57 PM
Can you show us what your data looks like?
Create an indicator at the green dot, run your VI, then go to edit >> make current values default. Upload your VI again (for 2012) and we can see what typical data looks like.
05-03-2017 01:27 PM
Hi Gregory,
I set a conditional breakpoint at i = 100, just to see what was happening a few cycles in. Here's a screenshot of the variables I set up probes on:
Probe 16 is just the loop counter.
Probe 17 is the current Power Spectrum cluster, removed from the array.
Probe 18 is the size of the magnitude array (part of the Power Spectrum cluster).
Probe 19 is the array of Power Spectrum clusters.
Also put an indicator on the front panel, displaying the size of 19, above.
What's strange is that 19 has stuff in it, but 17 doesn't & the size of the array of Power Spectrum clusters is, at most, 1, then drops to zero, I'm not sure when.
It's almost like LabVIEW doesn't want me looking at what's in 19 🙂
And why is the array size only 1? Is the first element just replaced over & over? Then why make it an array?
Strange stuff.
Thanks,
Evidental
05-03-2017 01:34 PM
Hi Gregory,
Sorry - I replied before reading your most recent reply. By typical data do you mean the very first spin through the loop? Cause that's the only time there is data - though that's not typical. What's typical is no data at all.
I just sent a screenshot of a Probe Watch that includes the spot you highlighted.
Thanks,
Evidental
05-03-2017 01:44 PM
I've only looked at it quickly, but I think it should have 1 array element corresponding to each of your input channels. Are you getting input waveforms from 1 channel? Then I would expect an array size of 1.
I'm not sure why you get an array of size 0 sometimes... you might try changing from Continuous Samples to Finite Samples when you create your DAQ task, and make sure it completes the task on every acquisition.
05-03-2017 01:52 PM
Hi Gregory,
Ok - that explains the array size of 1 - yeah, I'm using just one channel.
Here's the same program, after something like 1,000 cycles with current data set as default (in LV 2012).
Thanks,
Evidental
05-03-2017 01:57 PM
Ok, you will want to remove the indexing on the array (even before the 1999 iteration) since it will only be 1 element, you always want element 0. Then if you want the results from every iteration at the output, you'll use an auto indexing tunnel. For actually writing to the file there is still work to be done, but you're getting there 🙂
05-03-2017 02:13 PM
That's it man! You did it! Thank you.
I just removed the indexing on that array, and then at the end selected the (number of averages - 1)th element of the output array generated by the auto indexing, and I have the most recent spectrum in my Excel sheet.
Thanks Again,
Evidental
05-03-2017 02:21 PM
Yes, 1 channel is an array of 1 waveform. N channel would get you an array of n waveforms.
So, the first iteration of the outer while loop indexes the 0th waveform. Indexing into anything other that the 0th element gets you a default for the datatype (Empty Waveform, defaults to: dt = 0, T0=0, Y=Empty Array of dbls) So your loop will execute exactly 0 times Wich gives you a default output (Empty Array of DBL) You then Build the two empty arrays creating.... You guessed it! an empty 2D array of DBLS. Untill the 2000th iteration when i = 1999 we see 1999 !< 1999 so we start indexing the 0th waveform again.
You have a problem