07-01-2011 04:12 PM
Hi,
I am writing a 2D array to a file.
1st column is Voltage, 2nd is Current.
I get the the correct format in my output array on the front panel, but when I open the file it was written to, the columns are shifted (see attached screenshot "shifted columns in file")
I don't understand where the shift is coming from, does anybody have an idea?
Thank you very much,
Sorry my VI is quite messy (still a beginner).
07-01-2011 04:36 PM - edited 07-01-2011 04:37 PM
My best guess is that you have some extra non-printing characters in there (e.g. tabs, linefeeds, etc.)
07-01-2011 05:10 PM
Here it is.
Thank you!
07-01-2011 05:29 PM
If you set the display format to \-code, you'll see that all array elements end in a hidden newline character (\n). You need to strip these out.
There are probably more efficient ways, but a very simple approach would be the use of "trim whitespace" as in the attached modification.
07-01-2011 05:49 PM
Thank you!
I was thinking: I can work with a newline between each line.
But how do you explain the shift between the two columns?
If you have any idea where that comes from, that would be great.
I can just fix that and leave the /n.
Thank you so much!
07-01-2011 06:07 PM
It's part of the raw strings coming from the instrument.