Given an array of non-integers, how can you find which value in that array is closest to an integer (any integer)?
Example (1): Given an array, x, find the index where x is closest to an integer.
x = [3.75 22.95 2548.01 424.5]
Answer: x(3) is closest to an integer (it is 0.01 away from the integer 2548).
Example 2: Given an array, "a," find where "a" is closest to an integer.
theta = linspace(0,90,900000);
d = 0.02;
l = 632.8e-9;
a = (2.*d.*cosd(theta))./l;
finds = find(array == floor(a));
Answer: I don't know and need your help!