06-01-2022 06:45 PM
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
06-01-2022 06:58 PM
for small data sets like that, I just build a 2D array and use "Write Delimited Spreadhseet.vi"
06-02-2022 07:17 AM
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:
06-02-2022 08:09 AM
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.