I\'m using Java HashMap in MATLAB
h = java.util.HashMap;
And while strings, arrays and matrices works seemlessly with it
h.
I'm not familiar with Java HashMaps, but could you try using a cell array to store the data instead of a struct?
h = java.util.HashMap; carr = {7, 'hello'}; h.put(7, carr); % OR h = java.util.HashMap; st.val = 7; h.put(7, struct2cell(st));