フィルターのクリア

If y(i) contain 5 values such as 1,2,3,4,5. Then i want to sum all the values with a single command but i can't solve this problem. Please help me out, my code is given below.

2 ビュー (過去 30 日間)
clc
clear
x=0;
for i=1:5
y(i)=x+i
z=sum(y(i))
end

採用された回答

the cyclist
the cyclist 2014 年 6 月 9 日
編集済み: the cyclist 2014 年 6 月 9 日
y = 1:5;
z = sum(y)

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGet Started with MATLAB についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by