MAT.jl
MAT.jl copied to clipboard
BoundsError when struct contains 3D char array
MWE:
In Matlab create struct with 3D char array and save as .mat
c1 = ['abc'; 'abc'];
char_array3D = cat(3, c1, c1)
s = struct('c', char_array3D)
save('s.mat', 's')
In Julia read .mat file containing 3D char array
using MAT
d = matread("s.mat")
Note that behavior is different for v7.3 (HDF5 format).
save('s.mat', 's', '-v7.3')
Now I get UInt16 arrays
julia> matread("s.mat")["s"]["c"]
2×3×2 Array{UInt16, 3}:
[:, :, 1] =
0x0061 0x0062 0x0063
0x0061 0x0062 0x0063
[:, :, 2] =
0x0061 0x0062 0x0063
0x0061 0x0062 0x0063