ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Standard functions / Numeric values functions / Matrix functions
  • Multiplying two matrices
MatMultiply (Example)
Multiplying two matrices
The following code is used to multiply two matrices.
We assume that the matrices are already created. The existence of the matrices is checked by MatExist. The number of columns in the 1st matrix must be equal to the number of rows in the 2nd matrix.
// -- Click code on BTN_Multiplication
// Declare the variables
ResMultiply is boolean
// Checks the existence of the matrices
IF MatExist("Matrix1") = True AND MatExist("Matrix2") = True THEN
// Nb. columns in the 1st matrix = Nb. rows in the 2nd matrix?
IF MatNbColumn("Matrix1") = MatNbLine("Matrix2") THEN
// Multiply the two matrices
ResMultiply = MatMultiply("Matrix1", "Matrix2", "MatrixResult")
IF ResMultiply = True THEN
Info("The multiplication was performed")
ELSE
// Display the error message
Error(ErrorInfo(errMessage))
END
ELSE
  Info("The number of columns is not equal to the number of rows")
END
ELSE
  Info("The matrices do not exist")
END
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 05/26/2022

Send a report | Local help