Need 32Bit Floating Data Converted Into .csv


HRose316

Recommended Posts

You can use a combination of the File.Open / File.ReadInter, File.Close function to read the file, To.Float to convert the binary to actual numbers, then file.writeDelim to write it back as a csv file.  Assuming you had 32 bit float binary format selected and your time precision was low enough that you only had two columns for time and 13 columns of data, it would be something like this:

 

private string path = "c:\data\mybinaryFile.bin"
private handle = file.Open(path, 1, 0,0,0)
global out
private t1 = to.Float(file.ReadInter(handle,0, 4*15, 4, 0))
file.SeekToBegin()
private t2 = to.Float(file.ReadInter(handle,4, 4*15, 4, 0))
out[][0] = t1 + t2
for (private i = 2, i < 15, i++)
   file.SeekToBegin()
   t1 = to.Float(file.ReadInter(handle,i*4, 4*15, 4, 0))
   out[][i-1] = t1
endfor
file.Close(handle)


handle = file.Open(path + "_OUT.csv", 0, 1, 0, 1)
file.WriteDelim(handle, out, ",", chr(10))
file.Close(handle)
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.