RW for char arrays with unicode support#234
RW for char arrays with unicode support#234foreverallama wants to merge 7 commits intoJuliaIO:masterfrom
Conversation
|
Looks like a great clean-up! I'm only slightly worried about performance because I know val-based dispatching can be slower than normal dispatching. See e.g. https://github.com/ztangent/ValSplit.jl |
|
The reference you linked mentions this:
Here, the What do you think? |
|
I don't think we need to update |
|
Added write support for both Julia string and char types. Added some tests with unicode characters as well. The basic gist is this:
I've added a bunch of tests for both read and write, and they all work with my version of MATLAB (2025b). I think I've handled some edge cases like 1D vectors and stuff as well. Honestly there's probably a better way to do this, could use some pointers there. Till then I believe this is a reasonable solution. |
Extension of #222 that attempts to fix several bugs in handling char arrays. I've attempted a common decode method
decode_char_arrayinMAT_types.jl. TheMAT_v5andMAT_HDF5readers now just read raw integer data, and then pass that todecode_char_arraywhere the data is decoded. Seems to work with N-D arrays without issue.So far all the test cases for
readpass. I'll add some more test cases to check this out, particularly with unicode characters. and N-D arrays. Will need to see how to incorporate the same changes inMAT_v4.jlas well.CC @matthijscox