MATLAB: Find function in Matlab

findMATLAB

Dear all ,
I have problem with this code
clc
close all
Signal = Hole1_mid;
Compare(:,1)=Signal(:,2);
value1 = 1.9752;
index1 = find(ismember(Compare,value1),n);
Hole1_6m(:,end) = Signal(1:index1,end);
Find function is not working in this case and I have no idea why

Best Answer

Try this:
tol_val = 0.001;
index1 = find(ismembertol(Compare,value1), n, tol_val);
See the documentation on ismembertol (link) for details. Choose the value for ‘tol_val’ that works with your data.
See the discussion in Why is 0.3 - 0.2 - 0.1 (or similar) not equal to zero? (link) for the reason ismembertol is preferable in situations such as those you are experiencing.