I have two arrays A and B which range in values from 1 to 10,000 in column 2. A is (111,2) and B is (38,2). I can use the code below to select a sequence of values from column2 closest to value 50, 100,150… etc, manually, each corresponding to a 0.5% increment. The intent is to arrive at two arrays, say C and D, each of which are dimension (200,2) with values in column 1 ranging 0 to 200 each being one half percent step, and the value in column 2 representing the column 1 bin count in each of A and B corresponding to that percentage increment. I cannot work out how to treat that value as a variable so I automate the search.
[min_val,ii]=min(abs(A(:,2)-50)); C(1,1)=1; C(1,2)=A(ii,1);
Cheers Bob Fitzell
Best Answer