07-13-2010 11:37 AM
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
Solved! Go to Solution.
07-13-2010 11:42 AM - edited 07-13-2010 11:43 AM
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.
07-13-2010 11:42 AM
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
07-13-2010 11:57 AM
Something like this.
07-13-2010 12:01 PM
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?
07-13-2010 12:21 PM
If you are going to use Write to Text File, you need to feed in a string, not an array. This code will work:
As an alternative, you could use the Write to Spreadsheet File function instead of the Write to Text File.
07-13-2010 12:24 PM - edited 07-13-2010 12:25 PM
@tbob wrote:
If you are going to use Write to Text File, you need to feed in a string, not an array.
Not true.
07-13-2010 12:29 PM
OK I didn't know that.
07-13-2010 02:06 PM
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.
07-13-2010 02:42 PM - edited 07-13-2010 02:43 PM
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.