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.
No se puede completar la acción debido a los cambios realizados en la página. Vuelva a cargar la página para ver el estado actualizado.
Translated by
Seleccione un país/idioma
Seleccione un país/idioma para obtener contenido traducido, si está disponible, y ver eventos y ofertas de productos y servicios locales. Según su ubicación geográfica, recomendamos que seleccione: .
También puede seleccionar uno de estos países/idiomas:
Cómo obtener el mejor rendimiento
Seleccione China (en idioma chino o inglés) para obtener el mejor rendimiento. Los sitios web de otros países no están optimizados para ser accedidos desde su ubicación geográfica.