AYUDA EN LÍNEA
 WINDEVWEBDEV Y WINDEV MOBILE

Ayuda / WLanguage / Funciones WLanguage / Funciones estándar / Funciones de valores numéricos / Funciones de matrices
  • 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
Versión mínima requerida
  • Versión 9
Esta página también está disponible para…
Comentarios
Haga clic en [Agregar] para publicar un comentario

Última modificación: 27/05/2022

Señalar un error o enviar una sugerencia | Ayuda local