function [layer] = picklayer(width,height) % Pick an arbitrary interface. % Only points in ascending order of X are input. % Pressing the 'Enter' key terminates the sequence of points. % width and hight are the dimensions of the area, % layer is array of picked points. position = 0; hold on; axis([0,width,0,height]); % plot range set(gca,'YDir','reverse'); % reverse the vertical axis pnt = ginput(1); % read a point from user input while (length(pnt) > 0 ) % accept only increasing X if ( position == 0 || pnt(1) > layer(position,1) ) position = position +1; layer(position,1) = pnt(1); layer(position,2) = pnt(2); plot(pnt(1),pnt(2),'bo'); if (position >=2) plot(layer( (position-1):position,1),layer((position-1):position,2),'r-'); end; end; pnt = ginput(1); end;