06-03-2026 06:02 PM
Hello,
I'm trying to fix an issue with a labview program provided to my company from a 3rd party, specifically with regards to writing data to a .csv file.
To summarize, this program reads a variety of data from a Power-Supply system thru a single USB-6001 DAQ, and exports said data to a .csv file on command. Everything about the program seems to work fine, EXCEPT for the fact that the first line of data accidentally gets added to the text header row. So instead of having a clean row of headers that looks like:
|| Date || Time|| kv Setpoint || .... || Filament Current || Filament Under Current Status || Fault ||
my top row actually looks like:
|| Date || Time|| kv Setpoint || .... || Filament Current || Filament Under Current Status || Fault5/22/2026 || 57:15.0 || 0 || ... || -0.109 || 0 || 1 ||
Unfortunately, I can't attach the full source code, due to proprietary issues. But if anyone knows a good resource that covers how to Write to a Text file WITHOUT ExpressVIs (as for some reason that's the only thing that pops up when I try searching for the issue) please let me know
06-04-2026 01:28 AM
Hi nim,
@nim87 wrote:
Everything about the program seems to work fine, EXCEPT for the fact that the first line of data accidentally gets added to the text header row. So instead of having a clean row of headers that looks like:
|| Date || Time|| kv Setpoint || .... || Filament Current || Filament Under Current Status || Fault ||
my top row actually looks like:
|| Date || Time|| kv Setpoint || .... || Filament Current || Filament Under Current Status || Fault5/22/2026 || 57:15.0 || 0 || ... || -0.109 || 0 || 1 ||
In CSV files you typically use a linefeed/LF (and/or carriage return/CR) char to end a "row": did you forget to add that LF char to your header line before writing the next line/row?
06-04-2026 09:55 AM
Simple solution. It's better to open the file ref and use the reference, but this should work for you.
Resulting .csv
Date Time Setpoint Filament
0.581 0.663 0.515 0.058
0.218 0.862 0.360 0.682
0.220 0.707 0.804 0.516
0.223 0.979 0.853 0.278
0.661 0.040 0.937 0.259
0.219 0.513 0.043 0.259
0.758 0.744 0.213 0.555
0.865 0.510 0.721 0.836
0.318 0.098 0.203 0.758
0.300 0.782 0.488 0.610
06-05-2026 09:23 AM - edited 06-05-2026 09:26 AM
I use the file primitives these days because this method has a couple advantages.