I know this is a really old topic, but this post appeared in searches that I did for the same problem, when I looked for a specific Matlab function, I could not remember the name - padarray.
So you can do:
A = [1 2 3; 4 5 6; 7 8 9];
A = padarray (A, [1 0], 'replicate', 'pre');
This is often useful if, for example, A is the output of a function that you did not explicitly store, so you do not know what the first line is. In any case, I hope this helps someone!
snooze_bear
source share