I need to sum the values around the perimeter of a matrix, is there sum function in matlab
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I assume there is a sum function and attempt the following code:
[x,y] =size(M)
Z = M(x:-1:1, y:-1,1);
Respuestas (2)
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))
1 comentario
Vivek Kumar Chouhan
el 20 de Abr. de 2018
this code works good for calculating perimeter of matrix of order higher than 2*2 but doesn't work for 2*2 matrix
Ibrahim Abouemira
el 19 de Mayo de 2019
Hello,
Here's a function that performs your required task.
0 comentarios
Ver también
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!