How do I avoid using for loop and vectorize when the i+1 th element of the array depends on the ith
2 views (last 30 days)
Show older comments
I want to do the following without the for loop
x=zeros(size(RB_all_m,1),1);
y=zeros(size(RB_all_m,1),1);
index_1=zeros(size(RB_all_m,1),1);
x=sum(indices(1:690,:).*RB_all_m(2:691,:),2);
y=sum(indices(1:691,:).*RB_all_m(1:691,:),2);
for i=1:(size(RB_all_m,1)-1),
index_1(i+1) = index_1(i)*x(i)./y(i);
end
0 Comments
Answers (1)
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!