Here is a simplified version of a
consider the data structure below in Matlab:
struct(1).left=1;struct(2).left=2;struct(3).left=3;
Now I would like to copy that into an array of integer
K>> arrayL(1:3)=struct.left
arrayL =
1 1 1
why it only copeis the first elements of struct.left into arrayL? how can I copy the entire struct(1:3) into arrayL so that it contains 1,2,3?
Thanks
I don’t have matlab handy at the moment, but try
arrayL = [struct.left];(becausestruct.leftby itself returns 3 separate answers, one for each element instruct).