Biomedical User Group Discussions

Showing results for 
Search instead for 
Did you mean: 

Convert an ECG raw data file into appropriate file format

I need to be able to open, display and proccess an ECG in Labview. I have attached txt file with the ECG raw data in HEX format

Below are instructions that can be used to draw the actual ECG image from the ECG raw data.

1)   The ECG measurement compressed data is received in the external system Web service request and returns all the signal points in a format ready for display.

2)   The ECG signal for display is built of 1 KHz samples per second. Each sample (point) value is given in uV units. For example a point with value 1000 = 1 mV (in the y-axis).

3)   The ECG signal for display graph points are calibrated to appear in the center of a +-5mv graph.

4)   The signal is provided in HEX string. One point is represented by 4 ASCII characters representing 4 Hex values for a 2 bytes signed-integer. The 2 bytes are listed in LSB to MSB order from left to right.

Example: the string AB34CDE5 represents 2 points

First point: AB34

Second point: CDE5

You can you the information above and the attached txt file for testing.


  • 0xCD
  • 0xE5
  • HEX Value 0xE5CD = 58829 (decimal value in uV units)

  • 0xAB
  • 0x34
  • HEX Value 0x34AB = 13483 (decimal value in uV units)
0 Kudos
Message 1 of 17


I create a simple VI to transform your txt to tdms file which could be loaded by Biomedical Startup Kit.



Message 2 of 17

Here is some another solutions made in Labview 7.0. While I was doing something else ZJ Gu posted a solution. If your RAW file is huge it may be better to not read the full into memory. But only read 4 bytes at the time. The solution from ZJ Gu may also be somewhat slower since  it require more memory accsess. But for small data sets this do not matter much. Who cares if it take 0.1 or 0.2 seconds to read a file

Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
(Sorry no Labview "brag list" so far)
Message 3 of 17


Thanks for sharing 


0 Kudos
Message 4 of 17

Thank you very match for your help and for your time! I have tested the software and it works perfectly.

I want to implement a software in Labview that can take this txt and display-analyse the ECG. The txts are saved in a standard directory (e.g. C:\). I can load them one at a time but is there a way to load the txt file exactly when it is saved in the directory (in other programming languages a way is using a timer to check the directory every 5secs and get a txt if it is saved)?

Thank you again for your time.


0 Kudos
Message 5 of 17


You could use while loop or user-defined event in event structure to capture when a new txt is saved.


0 Kudos
Message 6 of 17

Thank you all for your help,

I am trying now to get the ECG data directly from a webservice (not the txt anymore). I am importing the web service URL into the Labview. Then the labview recognizes the webservice and the application is automatically designed. I enter the correct data into the designed textboxes and i am trying to receive the data via the application. I get an error:

error code 1172

Error calling method WebServicesAdmin.WebServicesAdmin.UsersList, (System.ArgumentNullException: Key can not be null.

parameter name: key) <append><b>System.ArgumentNullException</b> in WebServicesAdmin.lvlib:Users

The input data (data inserted into the textboxes) is correct but I still get the error above. Any ideas?

Thank you.

0 Kudos
Message 7 of 17

Hi Homer,

I haven't any idea now. Could you please attach your VI here? Did you use Database Conectivity Toolkit?



0 Kudos
Message 8 of 17

Thank you for your quick reply.

No I am not using the database toolkit. I am just importing a webservice (tools->import->webservice)

Thank you

0 Kudos
Message 9 of 17

Thank you all for your time and your replies,

Following our activities to use the LaBView for Biomedical studies, we are trying to get the ECG data. We tried through the web-services but we didn’t manage that and now we are trying to get the data directly from an SQL database.

Within this realm I am trying to configure the “raw to tdms” application in order to get the data from a SQL database and not from a txt file.  The database format is in SQL 2005. I have downloaded the database connectivity toolkit and I made a successful connection with my SQL database. I am trying to use the SELECT command from the database toolkit but I cannot get the data from the SQL.

Does anyone know a quick way for getting data from the SQL server?

Thank you.

0 Kudos
Message 10 of 17