ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

array columns shifted

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).

 

 

Download All
0 Kudos
Message 1 of 6
(3,015 Views)
  • Please run your VI until the indicator "Id Vd Output Array 2" contains typical data.
  • Now right-click the terminal of this indicator and and select "create constant".
  • Place this diagram constant into a new VI and save and attach it here.

 

My best guess is that you have some extra non-printing characters in there (e.g. tabs, linefeeds, etc.)

0 Kudos
Message 2 of 6
(2,997 Views)

Here it is.

Thank you!

0 Kudos
Message 3 of 6
(2,987 Views)

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.

Message 4 of 6
(2,983 Views)

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!

0 Kudos
Message 5 of 6
(2,977 Views)

It's part of  the raw strings coming from the instrument. 

0 Kudos
Message 6 of 6
(2,975 Views)