change matrix in matlab

Status
Not open for further replies.

GRIFINA

Junior Member level 1
Joined
Dec 19, 2010
Messages
15
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
Indonesia
Activity points
1,369
I have matrix size 2x108x2,and i want convert this matrix to 2x2x108 with matlab program,
Anyone can help me?
Thanks
 

I have matrix size 2x108x2,and i want convert this matrix to 2x2x108 with matlab program,
Anyone can help me?
Thanks


Code:
B=reshape(A,2,2,108);
 

Hi Grifina,

you should specify how the elements are treated in the conversion.
I suppose you want a change in the order of the indices (not a reshape of the array).

Suppose your array is A(a,b,c) [a=2, b=108, c=2 in your case]. What you want is not totally clear because a=c in your case.
If you want to convert it into B(c,a,b) make this:

B = shiftdim(A,2)

If you want to convert it into C(a,c,b) it is a bit more involved.
regards

Z
 

thank you zorro,your post very helpfull
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…