LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Send numeric value in relative time format to text file

Hi, I'm trying to send a numeric value to a text file (.txt). However, this value must be in Relative Time format, which is displayed correctly in my front panel but not in my text file. The text file displays  it as an integer-.
 
I know that this can be achieved by sending a string instead of a numeric value, but the thing is, I'm sending other numeric values along with this one, which means ALL the data must be numeric in order for Labview to send it, since it does not seem to accept a polimorphic array of data.
 
Any suggestions?
0 Kudos
Message 1 of 7
(3,500 Views)
You can't have mixed data types in any type of array. It's not a problem with the write files at all. I'm assuming you want the time to appear in the file as HH:MM:SS. One simple option is to convert everything to strings.
0 Kudos
Message 2 of 7
(3,489 Views)

You could try using the Format into File function if you're willing to extract the individual elements of the array you have. 

However, you will still have the limitation mentioned above.  An array, by definition, is a set of items of a single type. 

S G
Certified LabVIEW Architect, Certified TestStand Architect, Certified Professional Instructor
0 Kudos
Message 3 of 7
(3,487 Views)

Than You. The thing is, I've tried turning everything to strings, but I'm using the funcion "Write to Spreadsheet" , which requires a numeric array input. I've tried using strings and the "Write to File" Function, but in this case, although it does write the data I'm sending, it insists on writing everything in a single line. That is, each time I run the VI, it writes the data at the end of the last written numbers. And I need it to be written in the next line every time I run it. Is there a way of doing this with said vi?

Thanks.

0 Kudos
Message 4 of 7
(3,471 Views)
You must be using an old version of LabVIEW. The latest version has a polymorphic Write To Spreadsheet File. One thing you could do is to modify Write to Spreadsheet File to accept string arrays. The directions for doing this are on the block diagram. Modify it and save it with a new name and in a new location. You can also look at the block diagram to see how to use Array to Spreadsheet String. This does accept string or numeric arrays. The output of this can be passed to the Write File function. Whatever you are doing now, you are not appending an eol after each line.
Message 5 of 7
(3,466 Views)
Here the resaved Write to Spreadsheet File.vi for writing String arrays.
- Partha ( CLD until Oct 2027 🙂 )
Message 6 of 7
(3,458 Views)
Thanks a lot Partha! That modified VI did the trick!Smiley Very Happy
0 Kudos
Message 7 of 7
(3,434 Views)