find is not matching a value of 1 in an array
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Jeremy Quandt
il 19 Mar 2020
Commentato: Jeremy Quandt
il 19 Mar 2020
I am unable to match a value of 1 with find when checking an array produced by linspace. Is this as expected behavior?
% Create our k samples.
k = linspace(0.1, 2.0, 20)
% Find indexes.
[find(k==0.5) find(k==1.0) find(k==1.5)]
0 Commenti
Risposta accettata
Più risposte (1)
Loren Shure
il 19 Mar 2020
You are running into an issue of floating point arithmetic. You might use ismembertol : mathworks.com/help/matlab/ref/ismembertol.html
Vedere anche
Categorie
Scopri di più su Signal Analysis in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!