Info
此问题已关闭。 请重新打开它进行编辑或回答。
How i save the value of c in deach loop and sum these value after each value then using value in another eq outside loop??
2 次查看(过去 30 天)
显示 更早的评论
Let say i have this simple loop,,
for i=1:3
A=x((i-1)*3+1);
B=x((i-1)*3+2);
C=x((i-1)*3+3);
Z=A*B+C*A;
end
i want the value of C in each loop to be sum and then using it in this eq let say,
W=E-C
because the value of C are different in each loop.
Thanks ^_^.
0 个评论
回答(1 个)
Mahdi
2014-6-5
Say E=3;
for i=1:3
A(i)=x((i-1)*3+1);
B(i)=x((i-1)*3+2);
C(i)=x((i-1)*3+3);
Z(i)=A*B+C*A;
W=E-sum(C);
end
此问题已关闭。
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!