howwould you in put this in to math lab with functions

1 view (last 30 days)
add all elements of vector x=[37294]

Accepted Answer

Star Strider
Star Strider on 9 Feb 2015
Assuming you intended to put spaces or commas between the numbers, use the sum function:
x=[3,7,2,9,4];
sum_x = sum(x)
produces:
sum_x =
25

More Answers (1)

Sean de Wolski
Sean de Wolski on 9 Feb 2015

Categories

Find more on Creating and Concatenating Matrices in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!