LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Writing data to excel in multiple columns

Hi,

I have 9 arrays of values that I concatenate into one array, which I then send through a formula node. I split the resulting array back into 9 arrays, which I would like to write to a spreadsheet file, such that each array is one column. I also have a "time" column which I want write as the first column, followed by the 9 columns (the arrays that went through the formula node).

Right now all I get is one long column.
Any suggestions?
0 Kudos
Message 1 of 9
(8,587 Views)

You need to wire each of your data arrays (PT100 1 through 9) as separate inputs into a Build Array function, with the Time array as the first input, for a total of 10 inputs.  Make sure the "Concatenate Inputs" option on the Build Array is not selected.  Then wire the resulting 2D array to the "2D data" input of the Write to Spreadsheet File.vi.  This should give you the data in the format you need.

You can learn more about constructing arrays by reading the LabVIEW Help on the Build Array function.

Good luck,

-D

Message 2 of 9
(8,573 Views)
Yeah, that works, thanks.
Now is there an easy way to insert column headers at the top of the columns?
It seems complex because this seems to require an array built both row-by-row and column-by-column...

0 Kudos
Message 3 of 9
(8,569 Views)

Yes, there is an easy way to insert columns or rows into your array.  Use the "Insert Into Array" function from the Array palette.  Then you can specify the row or column index at which you want to insert the new row/column.  If you want it to be at the beginning of the array (like if you want a row header or a column header), you would wire an index of zero.  Check out the LabVIEW Help for Insert Into Array for more information.

Hope this helps,

-D

0 Kudos
Message 4 of 9
(8,565 Views)
Well, all right. So I played around with number-to-string to be able to insert headers as a string array, but the spreadsheet file that comes out of this mostly only shows "F" characters.

I've attached the mess.
0 Kudos
Message 5 of 9
(8,559 Views)

If you want to see the numbers in normal format, you may want to consider using Number to Fractional String instead of Number to Hexadecimal String.  If you want to see the numbers in Hex, though, expect to see a lot of 'F's.  🙂

-D

0 Kudos
Message 6 of 9
(8,551 Views)
What I do is simply create a string with column headers separated by tabs (\t), then write this to the file with Write Characters to file.vi.  Then you write your spreadsheet to the same file and wire true to the Append to File input.
0 Kudos
Message 7 of 9
(8,546 Views)
Thanks, it's all good now.
0 Kudos
Message 8 of 9
(8,543 Views)

I am aquiring about 4 types of data continuously and I need to put each in a seperate column. What should I do?

(Building these data in 2D array is not an efficient way, is there any other way)

0 Kudos
Message 9 of 9
(7,664 Views)