2012-11-11 25 views

回答

7

你可以先扩大a有所需要的元素数目如下;

a(15) = 0 % Matlab will automatically fill elements 12:14 with 0 

然后

transformed = reshape(a,[5,3])' 

产生

ans = 

    1  2  3  4  5 
    6  7  8  9 10 
    11  0  0  0  0 
+0

是否有任何guaratee它将被用0填充?如果它不会并且可能有垃圾会怎么样? –

+1

阅读文档http://www.mathworks.co.uk/help/matlab/math/resizing-and-reshaping-matrices.html –