Output of a for loop into a vector?
6 views (last 30 days)
Show older comments
I need to get the output of this for loop that I created
x=[1 8 3 9 0 1];
b=0;
for i=1:length(x)
b=b+x(i);
end
to put the answers b into a vector eg y=[1 9 12 21 21 22]
I cant seem to do it, i feel like i need to add a y=zeros(size(x)) or something similar but nothing seems to work
thanks
0 Comments
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!