| DSP Blockset | ![]() |
Sum the elements of a matrix along rows or columns
Library
Math Functions / Matrices and Linear Algebra / Matrix Operations
Description

The Matrix Sum block sums the elements of an M-by-N input matrix u along either the rows or columns. When the Sum along parameter is set to Rows, the block sums across the elements of each row and outputs the resulting M-by-1 matrix. A length-N 1-D vector input is treated as a 1-by-N matrix.
When the Sum along parameter is set to Columns, the block sums down the elements of each column and outputs the resulting 1-by-N matrix. A length-M 1-D vector input is treated as a M-by-1 matrix.
The output of the Matrix Sum block has the same frame status as the input. This block accepts real and complex floating-point and fixed-point inputs.
Fixed-Point Data Types
The following diagram shows the data types used within the Matrix Sum block for fixed-point signals.
You can set the accumulator and output data types in the block mask as discussed in Dialog Box below.
Dialog Box
Same as input, these characteristics will match those of the input to the block. If you select User-defined, the Output word length and Output fraction length parameters become visible.
User-defined is specified for the Fixed-point output attributes parameter.
User-defined is specified for the Fixed-point output attributes parameter.

Same as output, the accumulator word and fraction lengths are the same as those of the output. If you select User-defined, the Accumulator word length and Accumulator fraction length parameters become visible.
User-defined is specified for the Fixed-point accumulator attributes parameter.
User-defined is specified for the Fixed-point accumulator attributes parameter.
Supported Data Types
To learn how to convert your data types to the above data types in MATLAB and Simulink, see Supported Data Types and How to Convert to Them.
See Also
| Matrix Product |
DSP Blockset |
| Matrix Multiply |
DSP Blockset |
sum |
MATLAB |
| Matrix Square | Matrix Viewer | ![]() |
Learn more about the latest releases of MathWorks products: |
| © 1994-2009 The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |