MATLAB: Loop for finding a threshold and change corresponding number

loop

hi, i have a dataset in the form [2000×730], where my variable of interest is 730. i want to use the loop and find the following equation.
aa=(data)-min(data)/max(data)+min(data);
which i already did with following code:
[m,n]=size(data);
% aa=zeros(m,n);
for i=1:m;
aa(i,:)=(data(i,:)-min(data(i,:)))/(max(data(i,:))-min(data(i,:)));
end
in second part since i have output file aa[2000×730]. i want to find the number where my data meets the required threshold i-e 0.76,
any idea how to loop for it,
regards and thnx in advance

Best Answer

As per my comment to the question, the loop you've shown is unnecessary:
aa = (data - min(data, [], 2)) ./ (max(data, [], 2) - min(data, [], 2)); %in R2016b
I'm assuming that you want to find where aa first crosses the threshold for each row. If not, see ImageAnalyst's answer.
[r, c] = find(aa >= 0.76)
crossthreshold = accumarray(r, c, [size(aa, 1), 1], @min)