This is both a request for expanded Matlab capabilities in future versions, and a question as to whether better methods than used below exist. I am attempting to use 'memmapfile' to read large binary files that have a custom header. Most of the data formats are standard (uint32,double, etc.) but there are a few that were written in formats not currently supported by memmapfile. E.g. as 'char' by a client using python. The payload itself is a complex64 (complex single) which is readable from Python.
(1) How can I read 'char' properly? Right now I have them just reading in as uint8's to get the correct size, so I either need to reinterpret them as 'char' (how?) or to read them as chars directly.
(2) How can I read a complex? Right now, the assumption (correct for this set) that each complex64 is really a pair of singles in the order [real, imag]. Thus, I can recreate the complex single using something of the form
dat = m.Data(1:2:end) + 1i*m.Data(2:2:end)
where m is my memory map. This works…but is so cludgy feeling that I wonder if there is a better way.
Regardless, expanding the supported formats for memmapfile would be appreciated.
Thanks, -Dan
Best Answer