Vector ind has indices I want to loop through, x has values.
ind = [1 3 5];x = [10 20 30 40 50 60 70];ind_len = size(ind,2)
Approach 1: When using a for loop, should I use the basic incremental for loop, where I access each element of x with index values from ind vector
for i = 1:ind_lenx(ind(i))end
Approach 2: Don't use ind_len length variable and assign ind vector to for loop
for i = indx(i)end
Which method is efficient ?
Best Answer