in each iteration I want to get the sum of all elements except of the i element
2 views (last 30 days)
Show older comments
Matthew Worker
on 26 Jun 2021
Commented: Rena Berman
on 16 Dec 2021
%% for example in the second itreation (i=2) I want the sum of all elements except the 3 (second element)
a=[1 3 2 1 4 2 1 5 1 2]
for i=1:length(a)
s= sum(aa(d+1:end))
end
2 Comments
Rik
on 15 Dec 2021
in each iteration I want to get the sum of all elements except of the i element
%% for example in the second itreation (i=2) I want the sum of all elements except the 3 (second element)
a=[1 3 2 1 4 2 1 5 1 2]
for i=1:length(a)
s= sum(aa(d+1:end))
end
Accepted Answer
More Answers (0)
See Also
Categories
Find more on Loops and Conditional Statements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!