In this example, we will assume that the matrices are already created. The existence of the matrices is checked by MatExist. The matrices must have the same dimensions (same number of columns checked by MatNbColumn, same number of rows checked by MatNbLine).

// --Click code on BTN_Add// Declare the variablesResAdd is boolean// Checks the existence of the matricesIF MatExist("Matrix1") = True AND MatExist("Matrix2") = True THEN// Same number of rows? IF MatNbLine("Matrix1") = MatNbLine("Matrix2") THEN// Same number of columns? IF MatNbColumn("Matrix1") = MatNbColumn("Matrix2") THEN// Add the two matricesResAdd = MatAdd("Matrix1", "Matrix2", "MatrixResult") IF ResAdd = True THENInfo("The addition was performed") ELSE// Display the error messageError(ErrorInfo(errMessage)) END ELSEInfo("The matrices do not have the same number of columns") END ELSEInfo("The matrices do not have the same number of rows") ENDELSEInfo("The matrices do not exist")END