I have a structure called poseSets, and it contains two things:
So what I want to do is make poses (Pose is a 4x4 matrix) into one big long matrix (4xN_Poses) x 4 .
So, let's imagine that I have a list of structures whose length is 10. I can get almost my list by doing the following:
[structList.Pose]
But this gives me a matrix (4xN) x 4 , i.e.
1 2 3 4 | 1 2 3 4 | 1 2 3 4 | ... 5 6 7 8 | 5 6 7 8 | 5 6 7 8 | ... 3 5 6 8 | 3 5 6 8 | 3 5 6 8 | ... 0 0 0 1 | 0 0 0 1 | 0 0 0 1 | ...
But I really want this:
1 2 3 4 5 6 7 8 3 5 6 8 0 0 0 1 _______ 1 2 3 4 5 6 7 8 3 5 6 8 0 0 0 1 _______ 1 2 3 4 5 6 7 8 3 5 6 8 0 0 0 1 _______ : : : :
Now I can not transpose it, because each of the matrices will be individually transposed and will be in the wrong way.
Now you can solve this with the for loop:
poseList = []; for i = 1:length(PoseSets); poseList = [poseList; PoseSets(i).Pose]; end
Note. poseList contains what I want.
But I personally believe that Matlab is magic, and you should be able to write what you want in English, and Matlab will deliver. Does anyone know one liner or the best way to do this?
source share