MATLAB: Reshape a matrix order

reshape matrix

Hi,
Vv =
1
2
3
4
5
6
7
8
9
and have transposed onto :
g =
-1 -1 -1 -1 -1 -1 -1
-1 1 3 5 0 0 8
-1 2 4 6 7 0 9
and using
Ans(zi) = reshape([Vv'], [], 1)'; to get reshaped to:
-1 -1 -1 -1 -1 -1 -1
-1 1 2 3 0 0 4
-1 5 6 7 8 0 9
but keep getting error.

Best Answer

With some guessing:
GT = G.';
zi = find(GT == 0);
GT(zi) = Vv;
g = GT.';