How to get Sum the values of positive even elements from vector x using only one command?
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
The question is
Write one Matlab command to get the following from vector x:
- Sum the values of positive even elements
0 commentaires
Réponses (1)
Stephan Ciobanu
le 14 Jan 2021
% Hi!
% You can try this:
My_sum = sum((x(2:2:end)>0).*x(2:2:end));
0 commentaires
Voir également
Catégories
En savoir plus sur 2-D and 3-D Plots 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!