Previous Up Next

5.49.23  Exchange two columns: colSwap, colswap, swapcol

colSwap (or colswap or swapcol) takes three arguments: a matrix A and two integers n1 and n2.
colSwap returns the matrix obtained by exchanging in A the column of index n1 with the column of index n2.
Input:

colSwap([[1,2],[3,4]],0,1)

Output:

[[2,1],[4,3]]

Previous Up Next