12-12-2018 10:07 AM
When I send a string array to a .csv file the strings are modified. Example: The string 29,000 is changed to 29. I'm not sure if this is a LabVIEW or Excel problem. I've attached Test.vi.
Solved! Go to Solution.
12-12-2018 10:16 AM - edited 12-12-2018 10:18 AM
The strings aren't modified - open the file in notepad and you will see the file is as you wrote it - 10.000E-6,29,000. But, when you try and open it in Excel, if you tell Excel it's a comma separated variable file, it assumes the '29,000' is two variables. So, dont use strings with nested comma's in a CSV file, or use some other character as a delimiter.
12-12-2018 10:21 AM
Thanks. I see that now, but my other string 10.000E-6 is changed to 1.00E-05.
12-12-2018 10:25 AM
Hi MPerlick,
The 29 is coming out weird because you have placed a comma within that string and used comma as the delimiter which causes the write VI to parse that number into two numbers, which is why you also see a 0 in the cell next to 29. That's the ",000" portion of the string which has been parsed into a separate cell. All you need to do is remove the comma from the number or use a different delimiter.
12-12-2018 10:28 AM
@MPerlick wrote:
Thanks. I see that now, but my other string 10.000E-6 is changed to 1.00E-05.
Same number, different representation - again, the original string is maintained if you open the file in notepad. Its an excel setting to display it as 1.00E-05 verses 10.000E-6.
12-12-2018 10:28 AM
Thanks DJColeslaw:
I did remove the comma, but I'm still having an issue with the string 10.000E-6. It's coming out as 1.00E-05. This should be a string.
12-12-2018 10:30 AM
@MPerlick wrote:
Thanks DJColeslaw:
I did remove the comma, but I'm still having an issue with the string 10.000E-6. It's coming out as 1.00E-05. This should be a string.
That is the same number. It just moved the decimal point.
12-12-2018 10:31 AM
I suspect the change in formatting is due to Excel. If you select a column, right-click, and go to "format cells" you have quite a bit of flexibility in setting how Excel formats the data it interprets. Less feature-rich text editors that don't auto-format the text won't have this problem.
12-12-2018 10:39 AM
@DJColeslaw wrote:
I suspect the change in formatting is due to Excel. If you select a column, right-click, and go to "format cells" you have quite a bit of flexibility in setting how Excel formats the data it interprets. Less feature-rich text editors that don't auto-format the text won't have this problem.
It is - if instead of saving the file as a csv file, you save it as a text file, when you then try and open it in Excel it will take you through an import wizard that will allow you to specify the format of the data.
12-12-2018 11:08 AM
Thanks again. I see my data is saved as Scientific. I'll try your suggestion and save it as a text and then try to open it in excel and use the import wizard. I wouldn't be so picky, but this is the test results data for the customer.