You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: pickregion.m
    path of file: ./repos/Robotics-Toolbox/rvctools/release10.3.1/common
    
    the code of the file until where you have to start completion: %PICKREGION Pick a rectangular region of a figure using mouse
%
% [p1,p2] = PICKREGION() initiates a rubberband box at the current click point
% and animates it so long as the mouse button remains down.  Returns the first
% and last coordinates in axis units.
%
% Options::
% 'axis',A     The axis to select from (default current axis)
% 'ls',LS      Line style for foreground line (default ':y');
% 'bg'LS,      Line style for background line (default '-k');
% 'width',W    Line width (default 2)
% 'press
    
function which draws the box in
%   the wrong location on my Mac's external monitor.
%
% Author::
% Based on rubberband box from MATLAB Central  written/Edited by Bob Hamans 
% (B.C.Hamans@student.tue.nl) 02-04-2003, in turn based on an idea of 
% Sandra Martinka's Rubberline.
    
function [p1,p2]=pickregion(varargin)
    % handle options
    opt.axis = gca;
    opt.ls = ':y';
    opt.bg = '-k';
    opt.width = 2;
    opt.pressed = false;
    
    opt = tb_optparse(opt, varargin);

    h = opt.axis;
    
    % Get current user data
    cudata=get(gcf,'UserData');
    hold on;
    
    % Wait for left mouse button to be pressed
    if ~opt.pressed
        k=waitforbuttonpress;
    end