Borrar filtros
Borrar filtros

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

1 visualización (últimos 30 días)
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 comentarios
DJ V
DJ V el 8 de Nov. de 2016
make that: [x,y] = size(A); y = sum(A(1,1:1:y))+sum(A(y,1:1:y))+sum(A(2:1:X-1,1))+sum(A(2:1:x-1,y));
DJ V
DJ V el 8 de Nov. de 2016
[x,y] = size(A); y = sum(A(1,1:1:y))+sum(A(y,1:1:y))+sum(A(2:1:x-1,1))+sum(A(2:1:x-1,y));

Iniciar sesión para comentar.

Respuestas (2)

Daniel kiracofe
Daniel kiracofe el 11 de Nov. de 2016
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 el 19 de Mayo de 2019

Categorías

Más información sobre Creating and Concatenating Matrices en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by