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)

추가 답변 (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