You need the command reshape
:
Say your initial matrix is (just for me to get some data):
a=rand(4,6,8);
Then, if the last two coordinates are spatial (time is 4, m is 6, n is 8) you use:
a=reshape(a,[4 48]);
and you end up with a 4x48 array.
If the first two are spatial and the last is time (m is 4, n is 6, time is 8) you use:
a=reshape(a,[24 8]);
and you end up with a 24x8 array.
This is a fast, O(1) operation (it just adjusts it header of what the shape of the data is). There are other ways of doing it, e.g. a=a(:,:)
to condense the last two dimensions, but reshape is faster.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…