09-17-2018 01:55 PM
Hello,
In the attached VI, I am trying to save the array given in the Input Array to a file, that can then be read in at a later time and when read, generate the same array as the Input Array.
The current VI, save the data in a skewed format and I cannot view the file correctly in Excel.
Is there a way to keep the formatting of the Input Array intact for saving and then for later retrieval?
Thanks,
hiNI
Solved! Go to Solution.
09-17-2018 02:15 PM
It looks like you're just concatenating all of the strings in your array and writing them to a file without any delimiters, which is going to smush them all together and give you no way to separate them back apart. I'd suggest using this Robust CSV package to create .csv files that can be opened in Excel or re-read in LabVIEW: https://lavag.org/files/file/239-robust-csv/
09-17-2018 03:36 PM
Hello,
I modified the VI as per your suggestion, however, the saved file still seems to be skewed.
(see attached VI).
Thanks.
09-17-2018 04:15 PM
In this updated file, the Output Array looks correct, but the saved data is still skewed when opened in Excel.
Thanks,
hiNi.
09-17-2018 04:53 PM
Your string array has cells in it that have linefeed characters in them. That is automatically create a new line when you save them. What do you expect those cells to loo like in the Excel file?
09-18-2018 08:04 AM - edited 09-18-2018 08:12 AM
Excel can hold a multi-line string in a single cell. I see that when I export such a cell from Excel to a .csv file, the resulting file has a linefeed character at the end of each line in the string, and Excel opens that file correctly. Can you attach your generated .csv file?
09-18-2018 09:49 AM
Hello,
I have attached is the generated CSV file.
I wanted the Excel file to look like this...
Basically, output what the Output Array looks like:
Thanks,
hiNi
09-18-2018 10:07 AM - edited 09-18-2018 10:07 AM
Excel is treating those numbers as strings. Enclosing the numbers in quotation marks forces Excel (or any other application that correctly interprets a CSV file) to consider the enclosed text as a string of text to be placed in a single cell. Even if there are line feeds.
09-18-2018 10:10 AM
Is there a solution for this issue then?
Thanks.
09-18-2018 10:52 AM
Change the file extension to ".csv" and Excel opens it correctly.