How to find the sum of each element of a matrix?
1 次查看(过去 30 天)
显示 更早的评论
采纳的回答
dpb
2015-6-28
If x is the array,
xsum=sum(x(:)); % ":" is a Matlab idiom that returns all elements in a column vector
3 个评论
Image Analyst
2015-6-28
That will work regardless of how many dimensions x has. By the way, a matrix is an array.
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!