Ok, I worked out the solution to this problem, if anyone is interested it is as follows. This determines the X value for a given Y value, in this case the max and min of Y values. X = X values, Y = Y values.
Xsize = size(X);
% Sets Xsize to equal total number of X readings
Xreduced = Xsize - 200;
% Sets Xreduced to equal total number of readings minus 200.
[a,b]=max(Y(1:200));
% Calculates maximum value for Y points 1 to 200, and locates X point. a = maximum Y value, and b = X value.
[c,d]=max(Y(Xreduced:end));
% Calculates maximum value for Y points end-200 to end, and locates X point. c = maximum Y value, and b = X value.
[e,f]=min(Y(1:200));
% Calculates minimum values for points 1 to 200, and locates X point. e = minimum Y value, and b = X value.
[g,h]=min(Y(Xreduced:end));
% Calculates minimum value for Y points end-200 to end, and locates X point. g = minimum Y value, and h = X value.
dXsize = d + Xsize - 200;
% Adds the remaining points to the minimum X value to give the position of X over the total of all data points.
hXsize = h + Xsize - 200;
% Adds the remaining points to the minimum X value to give the position of X over the total of all data points.
All the best!
Redbeard.