LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

time stamp data write to file problem

Hello!
 
I'm just learning LabView, and have arrived at the stage of writing time-stamped data to text files.
 
This seems clear enough, however when I examine the file written to disk, I find 4 unexpected characters: 3 spaces and one seemingly random number or punctuation mark, preceding every line!
 
An example is:
   .2005-07-15 10:55:40.0 the value is 0.0000 cm
   .2005-07-15 10:55:40.5 the value is 1.0000 cm
The four characters "   ." are those whose origin I can't understand. I can't seem to get rid of them.
 
They seem to change with the input string, but not in a manner I can predict or understand.
 
Any hints or explanations would be greatly appreciated, as I'm at wit's end after 1/2 day of puzzling over this little problem!
 
 
Alex
0 Kudos
Message 1 of 3
(2,258 Views)
Alex,

You found one of the subtle little things that can be frustrating to old-timers and newcomers alike. I did not recognize it until I read the help file (and I have been using LV since version 1.2).

First, the three characters before the commas are nulls (\00).

The reason they are there is in the help file for the Write File.vi. By wiring an array to the data input, you caused the VI to write a header telling what data format was used.

I modified your VI to simply concatenate the strings and then write a simple string to the file. I think this may be what you were after.

Lynn
0 Kudos
Message 2 of 3
(2,253 Views)

Lynn,

thank you very much for your help. I understand now the difference between your modified VI and my original one is: the input to Write File.vi is string vs. array. I guess the empty string outside the loop is to initialize the shift register to known value.  I see that I also didn't fully realize that building a string inside a loop would result in passing an array of strings upon loop termination, rather than each string individually being passed outside the loop during every iteration.

After reading the LabView help on Write File.vi, however, I must confess that it doesn't quite make sense why a header is written on every line (if input to Write File.vi is array). I would have guessed only at the beginning of the file...

I guess it's one of those things we must accept & work around.

 

Thanks again,

Alex

0 Kudos
Message 3 of 3
(2,246 Views)