The following code is used to fill a matrix. This matrix is filled from row 1 to 5 and from column 1 to 3 with the value 7. The existence of the matrix is checked by MatExist. The matrix is created by MatCreate. The name of the matrix is entered by the user in an edit control (EDT_MatrixName).
// Declare the variables ResExist is boolean ResOverwrite is boolean ResCreate is boolean ResFill is boolean // Checks whether the matrix exists ResExist = MatExist(EDT_MatrixName) // The matrix exists IF ResExist = True THEN // Overwrite the matrix? ResOverwrite = YesNo("This matrix already exists. Do you want to overwrite it?") END // The matrix does not exist or it must be overwritten IF ResExist = False OR ResOverwrite = True THEN // Create the matrix ResCreate = MatCreate(EDT_MatrixName) END // Error? IF ResCreate = False THEN // Display the error message Error(ErrorInfo(errMessage)) ELSE // Fill the matrix. // Fill matrix from row 1 to 5 and from column 1 to 3 with the value 7. ResFill = MatFill(EDT_MatrixName, 7, 5, 3) // Error? IF ResFill = True THEN Info("The matrix was filled") ELSE // Display the error message Error(ErrorInfo(errMessage)) END END
This page is also available for…
|
|
|
|