Storing MATLAB structs in Java objects

后端 未结 3 761
栀梦
栀梦 2020-12-05 21:34

I\'m using Java HashMap in MATLAB

h = java.util.HashMap;

And while strings, arrays and matrices works seemlessly with it

h.         


        
3条回答
  •  被撕碎了的回忆
    2020-12-05 21:57

    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));
    

提交回复
热议问题