Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old


Calculates sum value in a matrix column.

Component Version macOS Windows Linux Server iOS SDK
Matrix 9.2 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes
MBS( "Matrix.Sum"; MatrixRef; Column { ; firstRow; lastRow } )   More


Parameter Description Example Flags
MatrixRef The matrix reference number. $matrix
Column The index of the column.
Default is 0.
firstRow The index of first row.
Default is 0.
0 Optional
lastRow The index of last row.
Default is Matrix.Height-1.
5 Optional


Returns number or error.


Calculates sum value in a matrix column.
You got a record set in memory and we can walk over a column in a given row range to add the sum value.


Sums the values in a matrix:

Set Variable [ $matrix; Value: MBS("Matrix.New";3;3) ]
# Set the values of the matrix
Set Variable [ $r; Value: MBS( "Matrix.SetColumn"; $matrix; 0;"15¶07¶92" ) ]
Set Variable [ $r; Value: MBS( "Matrix.SetColumn"; $matrix; 1;"17¶3¶60" ) ]
Set Variable [ $r; Value: MBS( "Matrix.SetColumn"; $matrix; 2;"15¶1¶87" ) ]
# Add all numbers in the matrix (3x3)
Set Variable [ $a; Value: MBS( "Matrix.Sum"; $matrix; 0 ) ]
Set Variable [ $b; Value: MBS( "Matrix.Sum"; $matrix; 1 ) ]
Set Variable [ $c; Value: MBS( "Matrix.Sum"; $matrix; 2 ) ]
Set Variable [ $sum; Value: $a+$b+$c ]

Set Variable [ $r; Value: MBS("Matrix.Release"; $matrix) ]

See also

Blog Entries

This function checks for a license.

Created 8th April 2019, last changed 7th April 2022

Matrix.SetValue - Matrix.Text