| MATLAB Function Reference | ![]() |
Syntax
B = reshape(A,m,n) B = reshape(A,m,n,p,...) B = reshape(A,[m n p...]) B = reshape(A,siz)
Description
回傳一個維度為 B = reshape(A,m,n)
m x n 的矩陣 B,依行順序由 A 中取出元素構成 B。若 A 不具有 m*n 個元素,會發生錯誤。
B = reshape(A,m,n,p,...) or B = reshape(A,[m n p...])
回傳一個元素個數與 A 相同,但維度為 m x n x p x ... 的陣列。維度的乘積 m*n*p*...,須與 prod(size(A)) 同。
回傳一個元素個數與 B = reshape(A,siz)
A 相同,但維度調整為 siz,用一個向量來表示調整後的陣列的維度。prod(siz) 須同於 prod(size(A))。
Examples
A =
1 4 7 10
2 5 8 11
3 6 9 12
B = reshape(A,2,6)
B =
1 3 5 7 9 11
2 4 6 8 10 12
See Also
The colon operator :
| reset | residue | ![]() |