index error for find function
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
ankita
el 6 de Mzo. de 2014
Editada: Chandrasekhar
el 7 de Mzo. de 2014
I am trying to find the value of Signal_fft_hilbert at the values of newf. But i get the error:
??? Attempted to access Signal_fft_hilbert(14.6484); index must be a positive integer or logical.
I want to find the value at exactly 14.6484. How can I find the value?
newf=aa1(:)'
for s=1:length(newf)
ppks=find(Signal_fft_hilbert(newf(s)))
end
1 comentario
Dishant Arora
el 6 de Mzo. de 2014
You might have to go for interpolation to get the value at non- integral coordinates.
Respuesta aceptada
Iain
el 6 de Mzo. de 2014
Ok, it looks like you've got a vector "Signal_fft_hilbert", which I'm going to call "v".
If want v(14.6484). The only way you can get v(14. ... ) is if you interpolate.
doc interp1 % will tell you all about one function for interpolation.
Alternatively, if you want the v that corresponds to something having a value you could do something like:
v( time == 14.684324)
or
v(find(time > 14.00))
4 comentarios
Chandrasekhar
el 7 de Mzo. de 2014
Editada: Chandrasekhar
el 7 de Mzo. de 2014
hope this works replace
top1{k}=freq_s(locs(k)) with
evalin('base',['top1' num2str(k) '=freq_s(locs(k))';])
this will append the 'k' value to top1 every time and creates a new variable top1k in the workspace.
Más respuestas (2)
Chandrasekhar
el 6 de Mzo. de 2014
k = find(newf == 14.6484);
ppks = Signal_fft_hilbert(k);
17 comentarios
Niklas Nylén
el 6 de Mzo. de 2014
Editada: Niklas Nylén
el 6 de Mzo. de 2014
I misunderstood the question, removed my response but kept the answer to not lose the comments below.
3 comentarios
Ver también
Categorías
Más información sobre Matrix Indexing en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!