HRose316 Posted November 6, 2015 Share Posted November 6, 2015 Accidentally set my logging to 32bit floating and I need the data to be in a .csv file to be able to read it in Excel how can I do that? Any help is greatly appreciated! Link to comment Share on other sites More sharing options...
AzeoTech Posted November 6, 2015 Share Posted November 6, 2015 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 More sharing options...
HRose316 Posted November 6, 2015 Author Share Posted November 6, 2015 This worked perfectly! I had to make sure the files were in .bin format, but after I did that I'm now able to make use of my data. Thank you very much! Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.