how to sum every each rows on matrix

3 vues (au cours des 30 derniers jours)
Risma Fitriyani
Risma Fitriyani le 27 Déc 2022
Commenté : Image Analyst le 27 Déc 2022
i have size matrix 5x25, i want to sum every each rows and the output would be 5x1 matrix. how to do that? thanks in advance

Réponse acceptée

Rik
Rik le 27 Déc 2022
Modifié(e) : Rik le 27 Déc 2022
You can use the sum function:
data=rand(5,25);
sum(data,2)
ans = 5×1
13.3903 13.2063 14.1058 14.1462 11.5026
  1 commentaire
Image Analyst
Image Analyst le 27 Déc 2022
@Risma Fitriyani To learn other fundamental concepts, invest 2 hours of your time here:

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Matrix Indexing dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by