LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Names in Excel collums.

I got a string, with tabs between each collum.
This sting hold the names of each collum.
A 2D array holds the data.
I got a VI that writes the 2D data into an Excel sheets.
Now I want first inserting the names for each collum.


So I want something of the form:

Name A Name B Name C
Val1 Val2 Val3
Val4 Val5 Val6


I don't see how to concatenate both data-types

Does somebody have tips, hints or examples ???

Thanks !!

Kristof
Sipex
Belgium
0 Kudos
Message 1 of 5
(3,128 Views)
Convert the array of numbers to strings, then you just have a 2D array of
strings with your headings in the first row and numbers in the rest. When
passing data to Excel, the array can be either strings or numbers so this is
fine.

Alternatively, leave the first row blank in the Excel sheet, write your
numeric array, then write a 1D array of strings to the first row.

Kristof Poppe wrote in message
news:3AA8A9F1.11F7F72C@sipex.be...
> I got a string, with tabs between each collum.
> This sting hold the names of each collum.
> A 2D array holds the data.
> I got a VI that writes the 2D data into an Excel sheets.
> Now I want first inserting the names for each collum.
0 Kudos
Message 2 of 5
(3,128 Views)
I've fixed like you said. I've chosen the second way. So I can always have some
more control of what is exported to Excel.

Thanks !!


Craig Graham wrote:

> Convert the array of numbers to strings, then you just have a 2D array of
> strings with your headings in the first row and numbers in the rest. When
> passing data to Excel, the array can be either strings or numbers so this is
> fine.
>
> Alternatively, leave the first row blank in the Excel sheet, write your
> numeric array, then write a 1D array of strings to the first row.
>
> Kristof Poppe wrote in message
> news:3AA8A9F1.11F7F72C@sipex.be...
> > I got a string, with tabs between each collum.
> > This sting hold the names of each collum.
> > A 2D array holds the data.
> > I go
t a VI that writes the 2D data into an Excel sheets.
> > Now I want first inserting the names for each collum.
0 Kudos
Message 3 of 5
(3,128 Views)
Kristof,

I have attached my solution which sends directly two 2-D arrays, one string and one numeric, to the active spreadsheet window. You will have to play with the starting cell locations. I have them fixed by constants in the range cell specifiers in the two loops that write the arrays. You may also want to make changes as to which worksheet the data goes to.

Regards,
Bob
0 Kudos
Message 4 of 5
(3,128 Views)
You'd get a significant speedup and a simplification of your code if you
ditched those nested FOR loops and wrote the string array in one operation
and the numeric array in the other.. that IS why the "Range" object has an
optional "Cell2" input.

deserio@florida wrote in message
news:506500000005000000CF1B0000-983677784000@quiq.com...
> Kristof,
>
> I have attached my solution which sends directly two 2-D arrays, one
> string and one numeric, to the active spreadsheet window. You will
> have to play with the starting cell locations. I have them fixed by
> constants in the range cell specifiers in the two loops that write the
> arrays. You may also want to make changes as to which worksheet the
> data goes to.
>
> Regards,
> Bob
0 Kudos
Message 5 of 5
(3,128 Views)