 Help WLanguage WLanguage functions Standard functions Numeric values management functions Matrix functions MatInvert (Example) Inverting a matrix  MatAdd (Example) MatAdd MatCopy (Example) MatCopy MatCreate (Example) MatCreate MatDelete (Example) MatDelete MatDeterminant (Example) MatDeterminant MatError (Example) MatError MatExist (Example) MatExist MatFill (Example) MatFill MatFloatAdd (Example) MatFloatAdd MatFloatMultiply (Example) MatFloatMultiply MatInvert (Example) MatInvert MatMultiply (Example) MatMultiply MatNbColumn (Example) MatNbColumn MatNbLine (Example) MatNbLine MatRead (Example) MatRead MatReadColumn (Example) MatReadColumn MatReadLine (Example) MatReadLine MatStack (Example) MatStack MatTranspose (Example) MatTranspose MatWrite (Example) MatWrite Matrix management functions The matrices
 Inverting a matrix MatInvert (Example)See the associated help page Inverting a matrix The following code is used to invert a matrix. The name of the matrix is entered by the user in an edit control (EDT_MatrixName).We assume that the matrix is already created. The existence of the matrix is checked by MatExist. The number of columns must be equal to the number of rows. This determinant must not be null. // -- Click code on BTN_Invert// Declare the variablesResInvert is boolean// Checks whether the matrix existsIF MatExist(EDT_MatrixName) = True THEN // Nb. columns in the matrix = Nb. rows in the matrix? IF MatNbColumn(EDT_MatrixName) = MatNbRow(EDT_MatrixName) THEN   // Determinant not null? IF MatDeterminant(EDT_MatrixName) <> 0 THEN // Invert the matrix ResInvert = MatInvert(EDT_MatrixName, "MyReversedMatrix") // Error? IF ResInvert = True THEN Info("The inversion was performed") ELSE // Display the error message Error(ErrorInfo(errMessage)) END ELSE Info("The determinant is null") END ELSE Info("The number of columns is not equal to the number of rows") ENDELSE Info("The matrix does not exist")END Minimum version required Version 9 This page is also available for…