Learn R Programming

tropAlgebra (version 0.1.1)

swapMatrix: Swap Matrices

Description

This function interchanges the values of both matrices.This function works only if both matrices are of same size.

Usage

swapMatrix(X,Y)

Arguments

X

A matrix.

Y

A matrix.

Value

Swapped Matrix X and Y.

Details

If the size of both matrices are not same, it generates an error. This function swaps the matrices in memory(like pass by reference), it does not return the matrices, but interchanges their values.

Examples

Run this code
# NOT RUN {
x<-matrix(c(2,3,5,7),ncol=2,nrow=2)
y<-matrix(c(6,3,1,9),ncol=2, nrow=2)
swapMatrix(x,y)

# }

Run the code above in your browser using DataLab