Find Sum of array

1 次查看(过去 30 天)
Adam Levschuk
Adam Levschuk 2020-11-13
回答: James Tursa 2020-11-13
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

回答(1 个)

James Tursa
James Tursa 2020-11-13
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.

类别

Help CenterFile Exchange 中查找有关 Multidimensional Arrays 的更多信息

产品


版本

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by