The sum of positive elements of a matrix
11 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
merowing3
il 18 Set 2018
Commentato: Christopher Wallace
il 14 Gen 2021
Let M be a matrix with dimensions mxn. Calculate the sum of all positive elements of matrix M without using loop.
My code:
sum(M>0) % sum of all positive elements in respective column, we get vector with sum for each column
sum(sum(M>0)) % sum of all sums from vector
Correct or not?
0 Commenti
Risposta accettata
Più risposte (1)
Mohamed Hossam
il 14 Gen 2021
is there a certain command that gets the sum of postive even numbers of an array?
1 Commento
Vedere anche
Categorie
Scopri di più su Logical in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!