LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

write array to spreadsheet string

Solved!
Go to solution

Hi,

 

I have 3 numeric arrays and 1 string array.  I am try to use the function write array to spreadsheet string.  What is the easy way to do this, since I have both numeric and string, I can't create a 2d array directly?

 

Yik

------------------------------------------------------------------

Kudos and Accepted as Solution are welcome!
0 Kudos
Message 1 of 19
(4,885 Views)

You can pass your 2-D array of numbers into the Number to Fractional String function. This function accepts scalar, 1D and 2D arrays as input and creates an equivalent output array.

 

 

Use the array functions to combine the converted numbers and the string array into a single array, then pass this combined data to the write spreadsheet function.


Now is the right time to use %^<%Y-%m-%dT%H:%M:%S%3uZ>T
If you don't hate time zones, you're not a real programmer.

"You are what you don't automate"
Inplaceness is synonymous with insidiousness

Message 2 of 19
(4,873 Views)

The easiest way would be to write twice to the spreasheet string. 

Once for your string array and once for your numeric array, in the order you want the data to appear.

 

Make sure you append to the spreadsheet string when writing the second array.

 

Message 3 of 19
(4,868 Views)

You would first turn the numeric array into an array of strings (e.g. using "Number to fractional string"). Now all match. 🙂

Message 4 of 19
(4,867 Views)
Solution
Accepted by topic author jyang72211

This is pretty basic and a commonly asked question. First convert the numeric arrays to string arrays. The numeric/string conversion functions are polymorphic so you can connect a 1D or 2d array to the input.

 

 

Message 5 of 19
(4,865 Views)

So, within minutes you got four very different and conflicting answers ... 😮

 

(just kidding, they all are basically the same! :))

0 Kudos
Message 6 of 19
(4,850 Views)

It depends how you want the file to store the data.

 

Attached is an example of two methods mentionned above.  You can change the formatting so that you have the data on the same line or different lines.

 

There are many solutions depending on exactly what you want to accomplish.

 

--- didn't expect to see so many replies so quickly ---

 

Most people recommend converting the numeric array to string array first.  I offer an alternative 😉  or a choice of both..  😄

 

Message 7 of 19
(4,839 Views)

Nice, thanks!

------------------------------------------------------------------

Kudos and Accepted as Solution are welcome!
0 Kudos
Message 8 of 19
(4,821 Views)

The example I did was a bit hasty.  Here's the corrected version.

 

And I agree with Dennis' solution, which is the example in the middle of the block diagram (sampleData3.txt).

 

0 Kudos
Message 9 of 19
(4,809 Views)

Dear sir,

 

I am also facing this similar problem and the main problem being faced is with giving path to the spreadsheet..Is there some link for some tutorial where i can read on this.

0 Kudos
Message 10 of 19
(4,462 Views)