ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Write Data to File without Using DAQ Assistant

I'm new to writing VI's for LabVIEW and I'm having trouble generating an output file for sensor information.

 

Currently, I have a VI that can get the sensor values and display their value in real time. I'm trying to capture this data as it varies with time in either a .txt or .xls file so that the data can be imported to MS Excel. I'm familiar with this process using DAQ Assistant, but I'm not using a National Instruments DAQ now. I thought the Write to Text File function would work, but I can't figure out to how to delimit the data so that it can be imported to Excel. Then, I tried the Write to Spreadsheet function and I'm getting an error that I'm trying to store a double in an array of doubles. Is there a way to append values to a spreadsheet file like you can with a .txt file, or is there a way to delimit a text file so that it could be imported into Excel?

 

I've attached both VI's where I've attempted this.

Thanks for your help,

Ben

Download All
0 Kudos
Message 1 of 2
(3,213 Views)

On your Write to Spreadsheet file version, use a Build array to turn your scalar into an array.  You probably also don't want your loop running at full speed, so put a wait function in there.  And put a stop control in place of that false constant for the while loop conditional terminal so that you have a way to stop the VI without aborting it.

 

Try using a tab as a delimiter between data elements.  For some reason, Excel seems kind of stupid when you try to use a comma and doesn't easily recognize that as a delimiter unless you tell it to, which is ridiculous because a CSV file means "comma separated value".

 

Also, for your write to text file version, you need to use a carriage return or carriage return/line feed as your end of line so that it know when to start a new row.

0 Kudos
Message 2 of 2
(3,202 Views)