How to get Sum the values of positive even elements from vector x using only one command?

回答 (1 件)

Stephan Ciobanu
Stephan Ciobanu 2021 年 1 月 14 日
% Hi!
% You can try this:
My_sum = sum((x(2:2:end)>0).*x(2:2:end));

カテゴリ

質問済み:

2021 年 1 月 14 日

回答済み:

2021 年 1 月 14 日

Community Treasure Hunt

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

Start Hunting!

Translated by