- Adding a value to all the matrix elements
Adding a value to all the matrix elements
The following code is used to add the value 5 to all the matrix elements. 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.
// --Click code on BTN_AddValue
// Declare the variables
ResAddReal is boolean
// Checks whether the matrix exists
IF MatExist(EDT_MatrixName) = True THEN
// Adds the value 5 to all matrix elements
IF MatError(EDT_MatrixName) = 0 THEN
Info("The addition was performed")
// Display the error message
Info("The matrix does not exist")
This page is also available for…