Difference between revisions of "Bdf file conversion"

From Elsys Wiki - Help and Recources for TranAX and TraNET DAQ
Jump to: navigation, search
 
Line 7: Line 7:
 
To convert multiple of these *.bdf files at once, the following Formula Editor example can be used.
 
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.
 
Copy and paste the code below into TranAX Formula Editor.
 
[[File:ShiftedTraces.png]]
 
  
 
<syntaxhighlight lang=vb style="border:0px dashed blue">
 
<syntaxhighlight lang=vb style="border:0px dashed blue">

Latest revision as of 16:19, 12 October 2017

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