MATLAB: Sum Matrix excluding certain values

matrices

MatrixA = [1:10 ; 21:30 ; 8:17]
how to sum all the elements inside matrix A, if the element is greater than 3?

Best Answer

y = sum(MatrixA(MatrixA > 3))