LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

want to read .dat file(it is in Binary formate).

Hello,

 

I want to read .dat File and convert into the text file.

This file is in Binary format and I know the header information of binary file..

What i want to do in my project, is as follow.....

1) I have the data file(.dat File) of my ECG data.

2) Convert this data file into text file and the file which i can read or mean it.

3) convert this text file into TDMS file sothat  i can use it in Biomedical toolkit.

 

I have the problem in Step 2

In the step 2 i can not get the numeric data of data file, it is represented in some special character, number ,Alphabet any other type of symbol

i just want the text file which have data with delimiter and can read as a normal file

 

plz help

thanks in advance.

 

0 Kudos
Message 1 of 11
(9,985 Views)

Dear sir,

I also have little bit similar problem.

I also want to read the data file( .dat file) and convert this data file into the TDMS file so that i can use it in the biomedical toolkit to extract the ECG parameter because the biomedical read file VI takes only TDMS File formate as a input.

Please help .

Thanks in advance

0 Kudos
Message 2 of 11
(10,005 Views)

Hi Shagun,

 

as has been said in this thread before: you need to know the format of your "dat" file to be able to read it's content.

Do you know the format?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 3 of 11
(10,001 Views)

yes i know the format of dat file i mean i have a file which is in ASCII and want to convert in to tdms format so that it can be read by biomedical toolkit.

0 Kudos
Message 4 of 11
(10,000 Views)

Hi Shagun,

 

when you know the format, then it should be no problem to read the data from your "dat" file.

After reading those data you simple store them in a TDMS file…

 

- As your file is "human readable" (aka "ASCII") I suggest to use ReadDelimitedTextFile to read your data.

- For writing a TDMS file you need to use the TDMS file functions. (There are example VIs explaining their usage.)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 5 of 11
(9,997 Views)

You need to know the exact format of the binary file.
It is unlikely that we will be able to help, if you do not apply the sample file and its format

0 Kudos
Message 6 of 11
(9,975 Views)

Hi Shagun,

 

I merged your messages…

 

In the step 2 i can not get the numeric data of data file, it is represented in some special character, number ,Alphabet any other type of symbol

i just want the text file which have data with delimiter and can read as a normal file

You once wrote you know the format of that textfile…

Without providing more information about your "textfile" we cannot help much more!

Attach the file (or a smaller part of the file, if it's too big).

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 7 of 11
(9,974 Views)

Please can you share your VI to read Dat File...

Thanks in Advance.

0 Kudos
Message 8 of 11
(9,944 Views)

Hi Shagun,

 

again I moved your message from an unrelated thread into your own thread. Please stop hijacking old and unrelated threads!

 

share your VI to read Dat File...

To read the dat file is no problem at all:

check.png

The real problem is to parse the data afterwards!

 

So again I have to ask you to upload your dat file (or atleast a part of it) and to describe the data format used in that file. Once you said you know about all that…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 9 of 11
(9,939 Views)

If you do know the structure of your data, you can combine Reading and Parsing in a single step.  This Snippet assumes that I know that the Data file contains (only) an Array of a Cluster that contains Acquisition Configurations, for which I have created a TypeDef.  This opens the file, reads the data into a LabVIEW Variable of type "Array of Acquisition Configurations", then closes the file.

 Binary Read.png

If there are additional (different) types of data in the file, you can add additional Binary Read commands, wiring into the Data Type input the appropriate Data Type, and they will be read/parsed as well.

 

One caveat for this to work -- Arrays and Strings must have been originally written with "Size" information prepended.  Otherwise, you need to be able to deduce the sizes and, in a For Loop indexed to the Array size, read in single elements, passing them out through an indexing tunnel to build the Array of Whatever (or String).

 

Bob Schor

0 Kudos
Message 10 of 11
(9,920 Views)