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: draw_boxes.m
    path of file: ./repos/gptoolbox/mesh
    
    the code of the file until where you have to start completion: function p = draw_boxes(BN,BX,varargin)
  % DRAW_BOXES  Draw a list of boxes given minimum corners and maximum corners
  % 
  % p = draw_boxes(BN,BX)
  % 
  % Inputs:
  %   BN  #B by dim list of minimum corners
  %   BX  #B by dim list of maximum corners
  % Outputs:
  %   p  plot handle

    
function p = draw_boxes(BN,BX,varargin)
  % DRAW_BOXES  Draw a list of boxes given minimum corners and maximum corners
  % 
  % p = draw_boxes(BN,BX)
  % 
  % Inputs:
  %   BN  #B by dim list of minimum corners
  %   BX  #B by dim list of maximum corners
  % Outputs:
  %   p  plot handle
  %
  dim = size(BN,2);
  m = size(BN,1);
  switch dim
  case 3
    V = [];
    for x = 0:1
      for y = 0:1
        for z = 0:1
          V = [V;BN + bsxfun(@times,BX-BN,[x y z])];
        end