How to modify vectors in a for loop?
Show older comments
I am trying to write some code that will average every two elements in a vector. However, when I run my program the vectors aren't changed. Is there some scope issue?
xData=ones(11,1)
yDataInner=ones(11,1)
yDataOuter=ones(11,1)
for i=[1,23]
if mod(i,2)==0
xData(i/2)=mean(V(i),V(i-1))
yDataInner(i/2)=mean(sineInner(i),sineInner(i-1))
yDataOuter(i/2)=mean(sineOuter(i),sineOuter(i-1))
end
end
Accepted Answer
More Answers (0)
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!