2.49 delete one row from a matrix
Example, Given the folowing 2D matrix \(A\) delete the second row
\(\begin {pmatrix} 1 & 2 & 3\\ 4 & 5 & 6\\ 7 & 8 & 9 \end {pmatrix} \)
2.49.1 Mathematica
mat={{1,2,3},
{4,5,6},
{7,8,9}};
mat[[2]]=Sequence[];
mat
|
Out[81]= {{1,2,3},
{7,8,9}}
|
| or a little longer solution using Pick
{nRow,nCol}=Dimensions[mat];
mask=Table[True,{nRow},{nCol}];
mask[[2]]=False;
Pick[mat,mask]
|
Out[70]= {{1,2,3},
{7,8,9}}
|
2.49.2 Matlab
A=[1 2 3;4 5 6;7 8 9];
A(2,:)=[]
|
A =
1 2 3
7 8 9
|
2.49.3 Maple
A:=<1,2,3;
4,5,6;
7,8,9>;
A:=LinearAlgebra:-DeleteRow(A,2);
|
[1 2 3]
A := [ ]
[7 8 9]
|