function hash_right(xvector,yvector,angledeg)
% Puts five hash marks on the right side of a line.
% Vectors xvector and yvector define the line.
% Optional input angledeg is the angle in degres from horizontal 
% that the hash lines make with the horizontal axis.
% Typically, angle is in the range -90 to +90 degrees.
% When angledeg is positive the line slopes upward.
% Default angledeg is -45 degrees.
% Version 2.0 2/2/05


%ISHOLD returns 1 (true) if hold is on, and 0 (false) if it is off.
if ishold
	%do this is hold is on
	holdwason=1;
else
	% do this if hold is off
	holdwason=0;
end

v=axis;
%xmid=(v(2)-v(1))/2 +xvector(1);
%ymid=(v(4)-v(3))/2 +yvector(1);
xmid=(v(2)-v(1))/2 +v(1);
%ymid=(v(4)-v(3))/2 +v(3);
ymid=(max(yvector)-min(yvector))/2+min(yvector);
xinc=(v(2)-v(1))/50;
%yinc=(v(4)-v(3))/50;
yinc=(max(yvector)-min(yvector))/50;

horizontal=0;
if yinc==0; yinc=(v(4)-v(3))/50; horizontal=1; end
if nargin==3
	%disp(' Do this if angledeg is passed to this function')
	ydelta=-xinc*tan(angledeg/57.3);
else

	%disp(' Do this if angledeg is not passed to this function')
	ydelta=yinc;
end


if horizontal==1
    % for horizontal line
    xdat=[xmid,xmid+xinc,xmid+2*xinc,xmid+3*xinc,xmid+4*xinc];  
    xdat2=xdat-xinc;   
    ydat=[ymid,ymid,ymid,ymid,ymid];
    ydat2=ydat-ydelta;
    %disp('horizontal')
else
    % sloped or vertical line
    ydat=[ymid,ymid+yinc,ymid+2*yinc,ymid+3*yinc,ymid+4*yinc];
    % YI = INTERP1(X,Y,XI)
    xdat=interp1(yvector,xvector,ydat);
    xdat2=xdat+xinc;
    ydat2=ydat-ydelta;
    %disp('sloped or vertical line')
end


hold on
plot([xdat(1),xdat2(1)],[ydat(1),ydat2(1)],'r')
plot([xdat(2),xdat2(2)],[ydat(2),ydat2(2)],'r')
plot([xdat(3),xdat2(3)],[ydat(3),ydat2(3)],'r')
plot([xdat(4),xdat2(4)],[ydat(4),ydat2(4)],'r')
plot([xdat(5),xdat2(5)],[ydat(5),ydat2(5)],'r')


if holdwason
	% Do this if hold was originally on
	% Do nothing more, i.e. leave hold on
else
	% Do this if hold was originally off
	hold off
end
