Suppose that I have the matrix
A = {{8, 1, 6}, {3, 5, 7}, {4, 9, 2}};
In Matlab/Octave one may store a value in an element outside of the matrix whose size increases to accommodate the newcomer:
>> A = magic(3);
>> A(4,5) = 17;
>> A
A =
8 1 6 0 0
3 5 7 0 0
4 9 2 0 0
0 0 0 0 17
How is possible to achieve a similar behavior in Mathematica?
ArrayRulesandSparseArrayor withArrayPad(or other padding functions.) Which solution to use depends on what size of matrices you are going to deal with. Also, this way of increasing dense matrices might be seen as a bad practice from certain viewpoints. – Anton Antonov Apr 28 '18 at 10:21