Learn R Programming

tropAlgebra (version 0.1.0)

swapMatrix: Swap Matrices

Description

This function inchange the values of both matrices Both Matrix must have equal number of rows and columns.

Usage

swapMatrix(x,y)

Arguments

x

A matrix

y

A matrix

Value

Returns the swapped Matrix x and y

Details

e.g.

[1] [2] [1] 2 3 1st matrix that is X [2] 5 7 [1] [2] [1] 6 3 2nd matrix that is Y [2] 1 9 Now, calling function... swapMatrix(X,Y) Then the swapped Matrices will be... [1] [2] [1] 6 3 1st matrix that is X [2] 1 9

and

[1] [2] [1] 2 3 2nd matrix that is Y [2] 5 7

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