From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
01-19-2015 10:51 AM
I am using build array function to put together a number of strings and build an array of strings. The build array is in a while loop. A new line is added to the array every loop. I am using write to spread sheet function to save the spreadsheet to a file with xls extension. For some reason, a carriage return is inserted within the array. The array has 9 columns and a carriage return is put after the fourth column. I have not added this carriage return. Does anyone know why write to spreadsheet might automatically add a carriage return and how to remove it?
Thank you!
Solved! Go to Solution.
01-19-2015 10:57 AM
I'd have to see some of your code. My guess is that you are putting in a End Of Line in the string for the 4th column.
01-19-2015 11:15 AM
My VI looks something like this. I do not have the carriage return problem on my personal computer. When I transfer the code to a stand alone (.exe) and run it on a different computer the carriage return problem appears. The saved file has has a carriage return before the time column.
01-19-2015 11:30 AM
Hi,
I took your posted VI and compiled it to an exe. I do not see the carriage return problem you are describing?
If you compile the VI you attached, do you see the problem or is it only in the original main application (that you cannot share)?
If the compiled exe works on your PC, does it also work on the 'different' computer where you see the issue with your original code?
-If it does work, then the issue must be in the source code for your original code. Sometimes, if you re-size string constants, for example, it can be hard to see carriage return's.
Another thing it could be perhaps, is if you are calling the "write spreadsheet" in two different places in your main code, then the way it works is it will write your two (different) input arrays to separate lines. If it is as in your example VI though, there should be no carriage return in the "middle" of the array.
For debug purposes, you could consider making a VI that takes a 1D string array input, iterates over each element in the array and searches for the carriage return character and gives an error/message on what iteration it found it, then you can back-track from there to see in the code responsible for making the string that went into that index.
01-19-2015 11:30 AM
The Carriage return appears after the first row. There is no carraige return after the fields row. It appears before the time stamp starting row 2.
01-19-2015 11:34 AM
Here is the original code. It is kind of big. I am using the write to spreadsheet more than once. Could you please explain how that might cause problems?
Thank you
01-19-2015 11:37 AM
You will need this file to run the code. It should be saved in C:\auto_labels\
01-19-2015 11:37 AM
This xls file
01-19-2015 11:38 AM
This xls file
01-19-2015 11:44 AM
I do see some reading from an instrument. If the instrument is appending the End Of Line as a termination character, that is likely where your extra carriage return is coming from.