From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

merge multiple *.dat files to one *.dat file

Solved!
Go to solution

Hallo,

 

I have multiple *.dat files from measurement. How to merge that's files to be one file?? Because I want one *.dat file can be plot in graph.

Should I create a separate vi? 

Or

Must be using addons toolkit in labview??

 

Please help me..

 

Thanks

 

regard,

 

angga

 

 

0 Kudos
Message 1 of 12
(27,203 Views)
I'm assuming this is a follow-up to your previous post. As noted in there, there is no predefined format for .dat. So, how to merge the files depends on the file format. There is no toolkit to do this. Is it a binary file? Does it have a header? If so, what's in the header? Is it an ASCII file? If so, what's the format? Does it have a header? A trivial solution is to read the first file using Read From Binary File, read the second file using Read From Binary File, concatenate the data (the default output of the Read From Binary File is a string), and write out the new file using Write to Binary File. If you have a binary file then make sure that "Convert EOL" is turned off for the read/write.
0 Kudos
Message 2 of 12
(27,196 Views)

hi macan,

  Actually to merge the dat files,there is no special toolkit but to write a seperate vi where we can merge the files.If there is any header,you need to take care of the header data too.To merge the files,you  should use the write to dat file,read from dat file, and set file position functions effectively.

 

 

 

T hanks and regards,

srikrishnaNF

Regards,
Srikrishna


0 Kudos
Message 3 of 12
(27,176 Views)

I have file like this.

 


Hosted by imgur.com

I have created .DAT file using Datalog function in labview.

 

 


Hosted by imgur.com

Sorry, I'm not understand about header..

 

 

regard,

 

angga

0 Kudos
Message 4 of 12
(27,168 Views)
Solution
Accepted by topic author macan

Hi macan,

  I just attached a screen shot of my block diagram about the file merging.Here already i created some three dat files i.e 1.dat,2.dat and 3.dat and i am

Example_VI_BD.png

 

 

 

 

 

 

trying to merge all files to 1.dat itself.

 

 

Thanks and regards,

srikrishnaNF

 

Regards,
Srikrishna


Message 5 of 12
(27,163 Views)

Thanks a lot srikrishnaNF...

 

its very help me...

 

 

regard,

 

 

angga

0 Kudos
Message 6 of 12
(27,151 Views)

srikrishnaNF wrote:

Hi macan,

  I just attached a screen shot of my block diagram about the file merging.Here already i created some three dat files i.e 1.dat,2.dat and 3.dat and i am trying to merge all files to 1.dat itself.


This will not work for datalog files. Datalog files have a header, so you cannot blindly concatenate the files. Since the OP has datalog files then you have to read the datalog file's records, concatenate them with the next one, and then write out a new datalog file. Something like the attached should work. 

Message 7 of 12
(27,131 Views)

Thanks for your correction. 

I tried this  vi. but I got problem. I put my file in path target file. when I run vi, original data file in path target files will lost, and overwrite with data files from folder source. is that right?? 

 

 

regard,

 

 

angga

0 Kudos
Message 8 of 12
(27,095 Views)
I'm not sure what you mean by "my file". As written the VI will replace the target file - that's what the "replace or create" constant does. I thought that's what you said you wanted - merge separate datalog files into a single file.
0 Kudos
Message 9 of 12
(27,090 Views)

Sorry, I have solved this problem. no problems again.

 

Thanks smercurio_fc. 🙂

 

 

regard, 

 

 

 

angga

0 Kudos
Message 10 of 12
(27,086 Views)