Filter löschen
Filter löschen

Find Sum of array

1 Ansicht (letzte 30 Tage)
Adam Levschuk
Adam Levschuk am 13 Nov. 2020
Beantwortet: James Tursa am 13 Nov. 2020
Hello, i am trying to find the sum of an array that contains elements that contain decimals. How would i go about doing this? the sum function is not working.
the array is:
0
0.410000000000000
0.330000000000000
0.330000000000000
0.350000000000000
0.350000000000000
0.340000000000000
0.360000000000000
0.340000000000000
0.330000000000000
0.340000000000000
0.360000000000000
thank you for your help

Antworten (1)

James Tursa
James Tursa am 13 Nov. 2020
It may be that you have a local variable called sum that is shadowing the MATLAB sum function. Try clearing it first:
clear sum
And then avoid using sum as a variable name in the future.

Kategorien

Mehr zu Multidimensional Arrays finden Sie in Help Center und File Exchange

Produkte


Version

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by