problem of for loop
1 回表示 (過去 30 日間)
古いコメントを表示
this is my programme
for k=1:10
x(k)=sin(k)
end
now i want to add all the 10 values together
0 件のコメント
採用された回答
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)
その他の回答 (0 件)
参考
カテゴリ
Help Center および 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!