How do I avoid using for loop and vectorize when the i+1 th element of the array depends on the ith
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
Answers (1)
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!