adding adjacent n elements in a matrix
4 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
OLUBUKOLA ogunsola
le 26 Juin 2016
Commenté : OLUBUKOLA ogunsola
le 26 Juin 2016
if i have a matrix like A= (1 2 3 4;5 6 7 8;9 10 11 12 ; 13 14 15 16) adding three adjacent elements will look like A(i,j)+A(i,(j+1))+A(i,(j+2)) how can i do this for n adjacent elements ?
0 commentaires
Réponse acceptée
Andrei Bobrov
le 26 Juin 2016
A= [1 2 3 4;5 6 7 8;9 10 11 12 ; 13 14 15 16];
out = conv2(A,[1 1 1],'valid')
3 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Matrix Indexing dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!