Filter löschen
Filter löschen

Write a single line code to sum all the odd numbers of an array.

1 Ansicht (letzte 30 Tage)
The code should contain only one line.

Akzeptierte Antwort

Abhishek Jain
Abhishek Jain am 4 Okt. 2016
You can use this code:
y = sum(x(rem(x,2)==1));

Weitere Antworten (0)

Kategorien

Mehr zu Data Types finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by