MATLAB.jl icon indicating copy to clipboard operation
MATLAB.jl copied to clipboard

mxarray on partially initialized structs

Open maartenvd opened this issue 4 years ago • 0 comments

In one of the packages I use there is a struct that gets partially initialized. This makes it so mxarray fails because of :

mxarray.jl:488 set_field(mx, names_str[i], mxarray(getfield(d, names[i])))

getfield throws an error, as this field isn't defined. I'm not entirely sure how to go about fixing this. I guess you could add a new UNDEF struct in matlab.jl, check if isdefined(d,names[i]) and if not, do set_field(mx,names_str[i],mxarray(UNDEF)) (if this sounds ok I'll open a pull request).

Alternatively, I can define my own mxstruct conversions for those problematic types.

maartenvd avatar Feb 03 '21 11:02 maartenvd