LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Time elapsed on chart does not match its indicator

Solved!
Go to solution

Hello,

 

I created a vi that displays three waveforms on a chart whose x-axis displays the time elapsed since the vi was started. The data are written to an excel spreadsheet. This all works as expected with the exception that the time column in my file does not match the time that is displayed on the x-axis of my chart. The time in my file only shows increments of 0.1 seconds, with the same sample for each ten-sample increment, whereas the time on the chart increases in increments of 0.001 (the precision I had set it to) and is unique for each amplitude data point. I've attached my output file for reference. The 'X' column is the time.

 

I'm collecting data at 100Hz and reading 10 samples at a time using the continuous sampling mode. WIthout my for loop for the x values, I get one time sample out of every ten -- which I understand why, given my sampling rate; with it I get that same sample for all ten samples (again, I think I understand why, but was foolishly hoping this would fix the issue). What I don't understand is why the time on my chart is incrementing differently than the time data I wrote to my file, since both are from the same source. Would anyone be able to help me understand this so I can try to fix my issue?

 

I've also included my vi. I'm using the USB 6229 OEM.

Download All
0 Kudos
Message 1 of 7
(3,270 Views)

Forgot to add: I put an indicator on the front panel as a test to determine whether the issue was linked to writing the data to my file, but the time data displayed on the indicator matches the data in my file -- it only increments by 0.1 seconds.

0 Kudos
Message 2 of 7
(3,269 Views)
Solution
Accepted by topic author curious_and_learning

That would be because you write 10 copies of t0 to the spreadsheet

Try this little maodification and see if that helpsSmiley Wink

Capture.PNG


"Should be" isn't "Is" -Jay
0 Kudos
Message 3 of 7
(3,251 Views)

Thank you, Jeff! That did it. I understand now that t0 is the first value for every group of data I sampled, and that I should not have assumed the value to increment on its own.

 

I achieved similar results using the Get Waveform Time Array vi as well.

0 Kudos
Message 4 of 7
(3,239 Views)

@curious_and_learning wrote:

Thank you, Jeff! That did it. I understand now that t0 is the first value for every group of data I sampled, and that I should not have assumed the value to increment on its own.

 

I achieved similar results using the Get Waveform Time Array vi as well.


Glad to help!  (Take a wild guess what the BD of Get Waveform time array.vi looks like) 

Spoiler
!1.png

 


"Should be" isn't "Is" -Jay
Message 5 of 7
(3,233 Views)

Thank you! That makes perfect sense!

Message 6 of 7
(3,183 Views)

@curious_and_learning wrote:

Thank you! That makes perfect sense!


One of my "favotite - all time" kudos-  now guess which code is more effecient!  (For the specific case--- in the general case the code you found has advantages)


"Should be" isn't "Is" -Jay
0 Kudos
Message 7 of 7
(3,163 Views)