LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

For loop with string

Solved!
Go to solution

Plataform: Labview Developer Suite Sound and Vibration Option 2009 SP1

 

I need format some number and strings to insert in txt file using For Loop. This structure above make the service but insert a blank space when execute external loop. I need remove this blank space, i tried several ways but dont get sucess.

 

Look to arrow in figure.

 

 

Leonardo de S. Cavadas
Maintenance Engineer and Inspection - Bureau Veritas do Brasil

Engineer Metallurgist with emphasis in Advanced Materials
Technologist in Computer Science
Download All
0 Kudos
Message 1 of 5
(5,006 Views)
Solution
Accepted by topic author leocavadas

The "Array to spreadsheet string" function apparently puts in a "carriage return, new line" pair every four lines (one "row" of the original array). I could find any setting that prevents it, not sure why it shows up as a space, but if you put a "search and replace" (from the string function pallette) and search for a "Carriage Return Constant" and replace with an "Empty String", setting the optional boolean "Replace All?" to true it removes them.

 

 

 

 

Putnam
Certified LabVIEW Developer

Senior Test Engineer North Shore Technology, Inc.
Currently using LV 2012-LabVIEW 2018, RT8.5


LabVIEW Champion



Message 2 of 5
(4,987 Views)

Very good, thanks. The headshot faster from forum.

Leonardo de S. Cavadas
Maintenance Engineer and Inspection - Bureau Veritas do Brasil

Engineer Metallurgist with emphasis in Advanced Materials
Technologist in Computer Science
0 Kudos
Message 3 of 5
(4,973 Views)

What is actually happening is that you are getting a \r\n at the end of each "row" of the 2D array. You are not getting a space. This is well-known behavior of the Array to Spreadsheet String, and is also documented:

 

Converts an array of any dimension to a table in string form, containing tabs separating column elements, a platform-dependent EOL character separating rows, and, for arrays of three or more dimensions, headers separating pages.

 

On Windows the EOL character is \r\n. So, each row will have a \r\n. If you were to use a tab instead of a \r and set the indicator to "\" display mode you would see this behavior:

 

0 Kudos
Message 4 of 5
(4,956 Views)

Others have already explaine what is happening. Here's a better way to do all this. Modify as needed.

 

 

(It seems useless to first built a 2D string array just to convert it to a spreadsheet string later. This can be done in one step. :))

 

 

Download All
Message 5 of 5
(4,940 Views)