Working around "Index exceeds matrix dimensions"
Mostrar comentarios más antiguos
I am looking for peaks in a trace with the following code.
for i= 1:length(y)
if y(i) < -0.02 && y(i-1) > -0.02
c=c+1;
n(c,:)=abs(y(i:i+npts-1));
end
end
sometimes i get the error "Index exceeds matrix dimensions" if a peak happens at the end of the trace and there aren't enough points to populate the row in "n"
I would like to either ignore this peak or fill the the missing positions with zeros. Any suggestions on how?
Thanks
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Matrix Indexing en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!