LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Writing to csv file without adding a newline

Hi,

I'm trying to write data to a CSV file where the data has to be written from within a nested for loop. If you look at the sample I've attached, I want to make a table with 10 rows and 4 columns. Each of the entries is written on a new line by default. Is there any way for me to specify where the newline is inserted?

I know for the example I've attached, I could just move the write to CSV VI outside of the nested for loop, but that won't work for the project that this relates to.

 

Thanks in advance

0 Kudos
Message 1 of 4
(2,102 Views)

for small data sets like that, I just build a 2D array and use "Write Delimited Spreadhseet.vi"

Message 2 of 4
(2,095 Views)

Maybe you can use Initialize array to create the table and specify the rows and column then, use Insert Into Array to insert element/s on specific column or row.
sample:

emtisiluis_0-1654172218406.png

 

0 Kudos
Message 3 of 4
(2,032 Views)

Open the file outside your loop, format your text and write to file, and write a newline when appropriate. Close the file once the loop has completed. The function that you're currently using is not intended for the approach that you're using and could be problematic in a larger application.

0 Kudos
Message 4 of 4
(2,015 Views)