The problem is to insert a row into the second row position in a 2D matrix
Mathematica
mat={{1,2,3}, {4,5,6}, {7,8,9}} mat = Insert[mat,{90,91,92},2]
|
{{1,2,3}, {90,91,92}, {4,5,6}, {7,8,9}} |
Matlab
Maple
Python
import numpy as np mat=np.array([[1,2,3], [4,5,6], [7,8,9]]) mat=numpy.insert(mat,1,[90,91,92],0)
|
array([[ 1, 2, 3], [90, 91, 92], [ 4, 5, 6], [ 7, 8, 9]]) |
Fortran