function pos(fig)
%
% Gets the size and position of figure(fig) and store on clipboard.
% Calling pos without argument stores position of current figure.
%
% example: "pos(3)" returns the message
% Clipboard contains: set(3,'position',[1717 532 560 420]);
% Paste this (CTRL-V) after your figure(fig); command in your m-file.
%
%  version:  2011.0
%  author:   Rob Hoogendijk
%  contact:  r.hoogendijk@tue.nl

if(nargin==0),fig=gcf;end;
posvec=get(fig,'position');
clipboard('copy', ['set(',num2str(fig),',''position'',[',num2str(posvec(1,1)),' ',num2str(posvec(1,2)),' ',num2str(posvec(1,3)),' ',num2str(posvec(1,4)),']);'  ])
disp(['Clipboard contains: ' clipboard('paste')]);
disp('Paste (CTRL-V) this after your figure(fig); command in your m-file.');