LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Writing arrays to spreadsheet w/ timestamp

Hi. I'm trying to build an application which will write a set of thermocouple values to a spreadsheet with a timestamp at the beginning of each row. What I have so far is a countdown loop which gives me regular intervals of time. When the loop reaches zero, the set of values in a global array variable goes into an "Array to Spreadsheet String.vi" then I use the Concatenate string to put a timestamp string, a space and the spreasheet string. Since "Write to spreadsheet.vi" needs an array input, I have to use the "Spreasheet string to Array.vi" then to the "Write to Spreadsheet.vi" So what this does is writes the TC values, but the timestamp gets lost somewhere in there and it write a completely wrong value
which looks nothing like a timestamp.
I appreciate any comments on this.
0 Kudos
Message 1 of 13
(5,516 Views)
In order to add a timestamp to each row, you will need to use the "write characters to file" VI. Since a spreadsheet is just a tab-delimited text file, you can use the "array to spreadsheet string" function to convert your array of data into a tab delimited string. Once you have this string, you can concatenate your time data to the start of it and write the resulting string to file.

I have created a simple example that writes randomly generated numbers to a spreadsheet every 0.5 seconds with a timestamp for each row. Hope this helps!
Message 2 of 13
(5,516 Views)
Matt thank a lot for your help. You solved my problem. I appreciate it.
Will
0 Kudos
Message 5 of 13
(5,516 Views)
Write to spreadsheet vi only acepts numerical arrays, to make it accept string values, you must change numerical controls by string controls, and save it with other name. After that, you can create a 2D array, the first column to the timestamp and the rest for TC values. Build array method is good for that. At last, pass this array to the modified write to spreadsheet.
Hope this helps
0 Kudos
Message 3 of 13
(5,516 Views)
Thanks Gorka. Your comments brought a lot of insight into my problem. I have been fortunate to get someone else to give me a solution, but I also tried yours out and it also worked. i really appreciate your help!

Will
0 Kudos
Message 4 of 13
(5,516 Views)

Hi,

 

I'm trying to do the same thing for my program and I'm just wondering if someone could please convert the VI above to version 8.6? 

 

Thank you,

Max 

Message Edited by oioi on 10-30-2008 05:00 PM
0 Kudos
Message 6 of 13
(4,945 Views)

Why post to such an old thread?

 

An easy way is to convert everything to strings, build an array of it all, and use the Write to Spreadsheet File (string type).

0 Kudos
Message 7 of 13
(4,940 Views)

Hi All,

 

I'm new to labview. How do I convert the Write to spreadsheet file to accept string type instead of number type?

 

Thanks,

B-man

0 Kudos
Message 8 of 13
(4,748 Views)
If you are using a current version of LabVIEW, you don't have to do much of anything. If you wire a string array to the input, it will automatically adapt. Or you can manually select the type by right clicking on it and do Select Type>String.  If you are using an older version, instructions for making a new VI that uses strings are on the block diagram.
0 Kudos
Message 9 of 13
(4,741 Views)
I have labview 8.6 and using Write To Spreadsheet File (DBL).vi. It gives me a broken wire and there's no option to change type.
0 Kudos
Message 10 of 13
(4,733 Views)