Effacer les filtres
Effacer les filtres

How to sum matrix value?

2 vues (au cours des 30 derniers jours)
KoolMU
KoolMU le 9 Mai 2015
Modifié(e) : KoolMU le 9 Fév 2018
I need to sum value in matrix but I can't use "sum". So, Can I sum value in matrix with if-else or while loop? How to create it. Assume I have matrix C=[ 1 2 3 4 5 6 7 8 9 ]
Thank You
  1 commentaire
the cyclist
the cyclist le 9 Mai 2015
Because you "can't use sum", I assume this homework. Show what you've tried so far, and maybe we can give you some hints.

Connectez-vous pour commenter.

Réponses (1)

Image Analyst
Image Analyst le 9 Mai 2015
Yes. You can use a while loop, or a for loop. I don't see how an if could be used. See this, and if you have trouble creating the code read this If it's homework, please add the tag "homework" and if it's not homework, say so explicitly.

Catégories

En savoir plus sur Loops and Conditional Statements 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!

Translated by