function [meshnodnew]=movenod(L,meshele,meshnod)
% [meshnodnew]=movenod(L,meshele,meshnod);
% Remove selected Nodes and all of the nodes triangles from the grid
% L = min and max for x,y axis
disp(['Click on node to be Moved and Click on its new location'])
disp(['Pushbutton quit method of meshtools/movenod'])

sou = ones(100,1);  
l = 1:2:99;
sou(l) = 0*sou(l);
sou2 = ones(100,1);
l = 1:4:99;  sou2(l) = 0*sou2(l);
l = 2:4:99;  sou2(l) = 0*sou2(l);

x = meshnod(:,2);
y = meshnod(:,3);


meshtri = meshele(:,:);
meshtri(:,1) = meshtri(:,4);
x4 = meshtri';
y4 = meshtri';




clf
fill(x4,y4,'w')
axis('equal')
axis(L)
title('Click on node to be Moved')
drawnow
pbquit = uicontrol(gcf,'Style','radio','String','QUIT' ...
 ,'units','normalized','position',[.02 .045 .107 .047] );

while(1)

x4(:) = x(meshtri');
y4(:) = y(meshtri');

fill(x4,y4,'w')
axis('equal')
axis(L)
title('Click on node to be Moved')
drawnow

sound(sou)
disp('Select a node to be moved')
[xin,yin]=ginput(1);
drawnow

if get(pbquit,'value')
  disp('  QUIT movenod')
  break
end

d = (x-xin).^2+(y-yin).^2;
nod1 = find(d==min(d));
disp(['Node #',int2str(nod1),'  at  ',num2str(x(nod1)),...
    ' : ',num2str(y(nod1))])
disp(['Click on location to move it to ']) 
sound(sou)
[xin, yin] = ginput(1);
drawnow
if get(pbquit,'value')
  disp('  QUIT movenod')
  break
end

 x(nod1) = xin;
 y(nod1)=yin;
 meshnod(nod1,2)=xin;
 meshnod(nod1,3)=yin;


end

meshnodnew = meshnod;

delete(pbquit)
disp('End of movenod')

