Create struct from multiple arrays in a one-liner

后端 未结 1 1799
遇见更好的自我
遇见更好的自我 2021-01-20 20:02

Let\'s say I have two arrays of the same size:

X = [1 2 3 4 ...]
Y = [1 2 3 4 ...]

But what I want is a struct:

S(1) =              


        
相关标签:
1条回答
  • 2021-01-20 20:52

    use struct and cells

    S = struct('X', num2cell(X), 'Y', num2cell(Y) );
    
    0 讨论(0)
提交回复
热议问题