Bdf file conversion

From Elsys Wiki - Help and Recources for TranAX and TraNET DAQ
Revision as of 16:40, 26 September 2017 by Tberger (talk | contribs)
Jump to: navigation, search

Fast recording and streaming to disk with Continuous or ECR mode (Event Controlled Recording) creates files with the extension *.bdf (binary data file). These files can be opened and handled with TranAX Data Acquisition Software and saved later in Elsys's standard *.tpc5 file format.

Convert multiple *.bdf files into *.tpc5 files

To convert multiple of these *.bdf files at once, the following Formula Editor example can be used. Copy and paste the code below into TranAX Formula Editor.

; Convert multiple bdf files to tpc5
; 26.9.2017 Elsys AG / TBE 
; TranAX 4.0 or newer

; Select directory with *.bdf files
path = "D:\Transfer"
retval = pause ("BDF file path:", path);
if retval = 1 then
   SetFormulaError("Aborted...")
endif

; Convert each file 
for each item in GetFiles(path, "*.bdf")
  SaveBDF2TPC5(item);
next


endformula
; Save bdf file as a tpc5 file
Function SaveBDF2TPC5(filenameBDF) 
  filenameTPC5 = GetFilenameWithoutExtension(filenameBDF, "bdf") + "tpc5"
  save(filenameTPC5, filenameBDF)
EndFunction


; remove file extension
Function GetFilenameWithoutExtension(filepath, extension) 
  GetFilenameWithoutExtension = Slice(filepath, 0, (Length(filepath)-1) - Length(extension))
EndFunction