Expand matrix from n x n to n+1 x n+1

Hello,

Is there a convenient function to augment in-place a matrix A from n \times n to n+1 \times n+1.

We can always do A = hcat(vcat(A, zeros(1, size(A,1))), zeros(size(A,1)+1,1))

As far as I know, there is no way to resize matrices in place. You can, however, do

n, m = size(A)

[A zeros(n);
zeros(m+1)']

which lowers to hvcat.

2 Likes

Thank you for your answer