How to resolve floating point numbers in if condition?
5 views (last 30 days)
I want to find max(cor). And when I do this:
for k = 1 : length(theFiles) % files are alreaady defined in code
cor(t)=arr(p); %cor(t) already defined in code
end %end of q loop
[val1,idx1] = max(cor) ;
idx2 = find(abs(arr-val1)<10^-3) ;
end % end of k loop
Again, it shows idx2 for some of the inputs when printed, but for some it shows blank. such as:
I don't know whether it is relevent information or not, but the file for which the output above is shown(That is blank idx2), has the minimum of all the val1 of other files, such as, the values of val1 for other files are as follows:
Where the value for blank idx2, the val1 is:
How do I fix it?