Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function teikna
- f = figure;
- aH=axes('Xlim', [0 1], 'Ylim', [0 1]);
- h=line([0.5 0.5],[0 1], ...
- 'color','red',...
- 'lineWidth',3,...
- 'ButtonDownFcn',@startDragFcn);
- set(f,'WindowButtonUpFcn',@stopDragFcn);
- function startDragFcn(varargin)
- set(f,'WindowButtonMotionFcn',@draggingFcn)
- end
- function draggingFcn(varargin)
- pt=get(aH,'CurrentPoint');
- set(h,'XData',[pt(1) 1-pt(1)]);
- end
- function stopDragFcn(varargin)
- set(f,'WindowButtonMotionFcn','');
- end
- end
Add Comment
Please, Sign In to add comment