this is my programme
for k=1:10
x(k)=sin(k)
end
now i want to add all the 10 values together

 採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2013 年 9 月 9 日
編集済み: Azzi Abdelmalek 2013 年 9 月 9 日

0 投票

If you mean to sum all the values use
for k=1:10
x(k)=sin(k)
end
out=sum(x)
%or without a for loop
k=1:10
x=sin(k)
out=sum(x)

1 件のコメント

mahesh chathuranga
mahesh chathuranga 2013 年 9 月 9 日
thank you very very much

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File Exchange で Loops and Conditional Statements についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by