JuliaIO / MAT.jl

Julia module for reading MATLAB files
MIT License
278 stars 76 forks source link

Julia symbol is returned as matlab struct #160

Open BambOoxX opened 3 years ago

BambOoxX commented 3 years ago

If one wants to save a symbol to a .mat file, this symbol is not stored. See the example below

using MAT
file = matopen("test.mat","w")
write(file,"symbol",:a_symbol)
close(file)

Matlab output

>> load('test.mat')
>> symbol

symbol = 

  struct with no fields.
JeffFessler commented 1 year ago

AFAIK, Matlab does not support symbol types. So it seems unlikely you would be able to save a symbol to a .mat file. Probably the closest option is to convert it to a string: write(file, "symbol", string(:a_symbol))

BambOoxX commented 1 year ago

@JeffFessler matlab surely does not support symbols.

The problem here is that this lack of support is not associated with a warning or an error. So one could assume that something should be expected but not an empty container.

My idea was