I need to sum the values around the perimeter of a matrix, is there sum function in matlab

2 次查看(过去 30 天)
I assume there is a sum function and attempt the following code:
[x,y] =size(M)
Z = M(x:-1:1, y:-1,1);

回答(2 个)

Daniel kiracofe
Daniel kiracofe 2016-11-11
For your second sum, instead of sum(A(y,1:1:y)) think you wanted sum(A(x,1:1:y))

Ibrahim Abouemira
Ibrahim Abouemira 2019-5-19

类别

Help CenterFile Exchange 中查找有关 Creating and Concatenating Matrices 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by