LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Only the first Spectrum sampled gets passed through to While Loop Tunnel

Solved!
Go to solution

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.

 

Capture.PNG

0 Kudos
Message 11 of 18
(1,526 Views)

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:

 

Breakpoint snapshot.png

 

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.

 

Watch-screenshot.png

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

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

0 Kudos
Message 12 of 18
(1,522 Views)

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

0 Kudos
Message 13 of 18
(1,519 Views)

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.

0 Kudos
Message 14 of 18
(1,518 Views)

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

0 Kudos
Message 15 of 18
(1,514 Views)
Solution
Accepted by evidental

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 🙂

Message 16 of 18
(1,511 Views)

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

0 Kudos
Message 17 of 18
(1,506 Views)

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


"Should be" isn't "Is" -Jay
0 Kudos
Message 18 of 18
(1,503 Views)