Skip to content

Conversation

@wordandahalf
Copy link

From the MATLAB documentation for fread, the char datatype does not have a fixed size. On my platform (Manjaro with kernel 6.12.19-1-MANJARO and MATLAB 2025a Prerelease Update 5) this resulted in broken reading of trigger in DAT files. It's not immediately obvious to me why it breaks, as the event type and size do not take on values that could confuse MATLAB if it were reading them as e.g. UTF-8. I've attached a hexdump of the file in question at the end of this PR.

In any case, this can be fixed by specifying a well-defined datatype (uint8) that is converted to char. It's not immediately clear to me why char is used instead of a proper integer type, but for posterity I have left it as the output type.

I also (pedantically) changed the capitalization of the timestamp unit. In SI, a capital "S" denotes siemens rather than seconds.

Mis-read trigger file
00000000  25 20 48 65 69 67 68 74  20 37 32 30 0a 25 20 56  |% Height 720.% V|
00000010  65 72 73 69 6f 6e 20 32  0a 25 20 57 69 64 74 68  |ersion 2.% Width|
00000020  20 31 32 38 30 0a 25 20  64 61 74 65 20 32 30 32  | 1280.% date 202|
00000030  35 2d 30 38 2d 31 31 20  31 36 3a 30 31 3a 32 35  |5-08-11 16:01:25|
00000040  0a 25 20 65 6e 64 0a 0e  08 af 31 00 00 01 00 00  |.% end....1.....|
00000050  00 4e b8 01 00 00 00 00  00                       |.N.......|

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant