problem of for loop

1 回表示 (過去 30 日間)
mahesh chathuranga
mahesh chathuranga 2013 年 9 月 9 日
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 日
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 件)

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by