LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Help with writing data to Excel

Hello, 

 

I have a DAQ Assist collecting 5120 samples at a rate of 5120 samples per second (continuous sampling). There is a trigger condition and once the condition is met (i.e. the force is above 20 lbs), the program would freeze the data collection at the point of triggering and write the data to Excel. I only wanted to write part of the 5120 samples point captured upon impact (in this case 1024 samples) to the sheet and I was able to do so. However, when checking the Excel file, I noticed that the program did write the 1024 desirable samples, but starting from row 1025 to row 5120 in Excel, all the cells had zeros instead of being empty. 

 

So, my question is: How do I fix this? 

0 Kudos
Message 1 of 4
(223 Views)

Hello, we will need to see your code to offer any help.

0 Kudos
Message 2 of 4
(210 Views)

Hi anhbui,

 


@anhbui0105 wrote:

So, my question is: How do I fix this? 


By writing code that fulfills your requirements!

 


@anhbui0105 wrote:

I only wanted to write part of the 5120 samples point captured upon impact (in this case 1024 samples) to the sheet and I was able to do so. However, when checking the Excel file, I noticed that the program did write the 1024 desirable samples, but starting from row 1025 to row 5120 in Excel, all the cells had zeros instead of being empty


Somehow you managed to replace the samples in your numeric array by zeros instead of using just an array subset.

When cells have the value "0" then most often you wrote numeric data (having the value 0) instead of (empty) string data…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 3 of 4
(172 Views)

Welcome to the LabVIEW Forum.  Here are some comments.

  • I'm "guessing" you are very new with LabVIEW, and with data acquisition and control, in general.  Hints are specifying sampling time as "5120 Hz" (I'd expect 5000 Hz, or 5 kHz), not attaching code so we can see what you are doing and suggest fixes, etc.
  • Are you really writing to Excel?  I'm guessing you are using the "Write Delimited Spreadsheet", which writes a text file with tabs or commas delineating columns and EOLs delimiting rows.  Just because Microsoft Windows automatically uses a Icon that looks as though it is Excel "doesn't make it so".
  • How are you sampling your data?  Most DAQ devices let you specify how many points you acquire for a single Read (say, 1000) and the sampling rate at which you acquire them (say 5000 Hz).  We'd need to see your code (or for you to tell us) what you told the (Dreaded) DAQ Assistant to do (not to mention how you set up your DAQ device).
  • To debug code, we need to see code.  Best is to attach your VI (or VIs, or entire Project).  Most "advanced" users of LabVIEW probably don't have the lates version of LabVIEW, hence cannot open your VIs, so you should use the "File" option and "Save for Previous Version", specifying LabVIEW 2019 or 2021, which seem to reach a higher fraction of "experienced users" than LabVIEW 2024 or 2025.

I'm going to take a wild guess and say you might have configured an Array of 5210 (Dbl? I32?) and filled it with 1024 samples.  When you write such an array, you'll get 5120 rows, the last 4096 of which are 0.

 

Bob Schor

 

 

 

 

0 Kudos
Message 4 of 4
(138 Views)