Given the matrix:
A = [1 2 3; 4 5 6; 7 8 9];
You are trying to sum up all the elements of 2-D Array
In Matlab use
Array_Sum = sum(sum(Array_Name));