Here, I defined X to have indices from 1:K/2+1 and I am using the values of ind_plus_wi to set values in X as such: X(ind_plus_wi) = v(i_M). But it is possible under certain circumstance for ind_plus_wi to have values that are outside the interval of X(1:K/2+1). I would like to skip over those. In the case where ind_plus_wi > K/2+1, I could just do X = X(1:K/2+1) and discard that data. However, if ind_plus_wi < 1, MATLAB will produce an error that I can't recover from. What can I do? Thanks!
Many people use i as a variable to do iteration in a for-loop, for example i=1:5.
Without knowing that i actually is a built-in constant. Do this:
clear all
length(i)
help i
In your code, you used length(i) first without assign value to i. So it is thinking that you are use i as the Imaginary unit. That is why it gives error.
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.