clear;
close all;
flag=1;
while flag
file=input('Please Input File Name: ','s');
if file==' '
flag=0;
else
close all;
Data=imread(file);
range=size(Data);
proportion=4800/range(2);
imagesc(Data);
colormap(gray);
axis off;
%h=axes('position','default');
%set(h,'XTick',[0:range(2)/8:range(2)]);
[x1,y1]=ginput(2);
y=round(y1);
x=round(x1);
%line(x1(1:2),y1(1:2),'color',[0.7,0.7,0.7],'linestyle',':');
a=x(1);
b=y(1);
w=x(2)-x(1);
h=y(2)-y(1);
rectangle('position',[a,b,w,h],'Curvature',[0,0]);
s=x(1):x(2);
%xaxeslength=(x(2)-x(1))*proportion;
newarea=Data(y(1):y(2),s);
grayscale=mean(newarea);
aver=mean(grayscale);
figure(2);
plot(s*proportion,grayscale);
end;
end;