could anyone help me to solve the issue for the following code.

1 次查看(过去 30 天)
code:
i=1:3
for j=1:length(i)
j=j+1
end
the code excutes and give the output j = 2
j = 3
j = 4
could anyone help how to add all the values (j=2+3+4)after for loop.

回答(1 个)

KSSV
KSSV 2019-4-16
编辑:KSSV 2019-4-16
Why you want to use a loop?
i = 1:3 ;
iwant = sum(i+1)
  2 个评论
jaah navi
jaah navi 2019-4-16
that is just the sample,I just gave with an example.
In my code i need to add up all the values generated by using formula after for loop each time.

请先登录,再进行评论。

类别

Help CenterFile 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