MATLAB: Combining pieces of frames into one

combine

Hi, is there any ways to put pieces of frames into a one complete frames?
So currently my code look something like this and i wanted to put Frames(1,:) , Frames(2,:), Frames(3,:) and Frames(4,:) together
(All there frames are audios):
for i = 1 : 10
Frames(i,:) = (frames(Randomlize_Frame(i),:));
end
Thank you.

Best Answer

Frames = reshape( frames(Randomlize_Frame, :).'. 1, [] )
What this does is reorder the rows of frames to the random order you want them in. Then it transposes rows and columns, so that the signals go down columns -- first column being the first sound you wanted in random order, second column being the second sound, and so on. Then reshape() with 1,[] re-arranges the memory so that the columns are all put one after another in consecutive memory, and made into a single row.
For example,
[ 1 1a 1b
2 2a 2b
3 3a 3b
4 4a 4b ]
random reordered to
[ 3 3a 3b
1 1a 1b
4 4a 4b
2 2a 2b ]
and then the reshape would temporarily make
[ 3
1
4
2
3a
1a
4a
2a
3b
1b
4b
2b ]
and then made into the row
[3 1 4 2 3a 1a 4a 2a 3b 1b 4b 2b]