What is the equivalent of 'fread' from Matlab in Python?

后端 未结 4 1072
生来不讨喜
生来不讨喜 2020-12-14 21:35

I have practically no knowledge of Matlab, and need to translate some parsing routines into Python. They are for large files, that are themselves divided into \'blocks\', an

4条回答
  •  北荒
    北荒 (楼主)
    2020-12-14 21:51

    The first part is covered by Torsten's answer... you're going to need array or numarray to do anything with this data anyway.

    As for the %08X and the hex2dec stuff, %08X is just the print format for those unit32 numbers (8 digit hex, exactly the same as Python), and hex2dec('4D445254') is matlab for 0x4D445254.

    Finally, ~= in matlab is a bitwise compare; use == in Python.

提交回复
热议问题