LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Transpose a 1D string array

Solved!
Go to solution

Hi,

 

I am trying to create headers in a write to text file.  Attached is my code and what the file looks like when opened in Excel. I have my data in three columns, but the headers are not where I need them to be. LabVIEW doesn't seem to allow a transpose of a string array. Is there a way I can get the headers in a row format and not a column?

 

Thanks

Download All
0 Kudos
Message 1 of 21
(9,140 Views)

Add an additional "build array" after creating your 1D array of column headers. This will convert the array into a 2D array with a single row.

Chilly Charly    (aka CC)
0 Kudos
Message 2 of 21
(9,120 Views)

Make a single string of your header strings. Put the same delimiter between them as you are using for the spreadsheet string.  You are now making an array with three elements and then appending the spreadsheet array string to that.

 

Lynn

0 Kudos
Message 3 of 21
(9,118 Views)
Solution
Accepted by topic author MJ40

Something like this.

 

18763i723FE2FEE39EEB84

Tim
GHSP
0 Kudos
Message 4 of 21
(9,089 Views)

Adding a build array then creates an error between the final array and the write to text file saying I am feedin a 2D array of string into a 1d array of string sink.

 

And in response to the second post, I am not aware that I did any delimiting with the data. I transposed it and fed it into the write to text file. The delimiting was not explicitly set. Is there a way to delimit a concatenated string?

 

 

0 Kudos
Message 5 of 21
(9,085 Views)

If you are going to use Write to Text File, you need to feed in a string, not an array.  This code will work:

 

18773iB4872BB7473FAC4C

 

As an alternative, you could use the Write to Spreadsheet File function instead of the Write to Text File.

 

18775i3EEBB9879A245DF7

 

- tbob

Inventor of the WORM Global
0 Kudos
Message 6 of 21
(9,060 Views)

 


@tbob wrote:

If you are going to use Write to Text File, you need to feed in a string, not an array. 


Not true.

 

0 Kudos
Message 7 of 21
(9,056 Views)

OK I didn't know that.

- tbob

Inventor of the WORM Global
0 Kudos
Message 8 of 21
(9,051 Views)

Thanks! I was able to fix the transpose problem.

 

However when my data is collected I have a strange offset. I tinkered with it and got some different excel output formats but not the one I want. Any ideas?

 

Code1 is the Code that gives the output to excel1.

 

Thanks.

Download All
0 Kudos
Message 9 of 21
(9,027 Views)

Put a probe on your header array before it goes into the last build array.  Put a probe on your data also.  See what you have there.  Put probes on each input to the last build array, see what you have there.  Finally put a probe on the final array going into the File write.

- tbob

Inventor of the WORM Global
0 Kudos
Message 10 of 21
(8,975 Views)