title: Matlab: Error obtained with rectangle function
body: <p>I am using MATLAB and want to use the <code>rectangle</code> function in order to plot a rectangle. I want the user to input the coordinates of each corner. I wrote the following:</p>
  <pre><code>xR1 = input('x coordinate of the first rectangle corner?');
  yR1 = input('y coordinate of the first rectangle corner?');
  
  xR2 = input('x coordinate of the second rectangle corner?');
  yR2 = input('y coordinate of the second rectangle corner?');
  
  xR3 = input('x coordinate of the third rectangle corner?');
  yR3 = input('y coordinate of the third rectangle corner?');
  
  xR4 = input('x coordinate of the fourth rectangle corner?');
  yR4 = input('y coordinate of the fourth rectangle corner?');
  
  XRcoordinates = [xR1 xR2 xR3 xR4]
  YRcoordinates = [yR1 yR2 yR3 yR4]
  
  width = max(XRcoordinates) - min(XRcoordinates)
  height = max(YRcoordinates) - min(YRcoordinates)
  
  rectangle('Position', min(XRcoordinates), min(YRcoordinates),width,height)
  axis([0   max(XRcoordinates)   0   max(YRcoordinates)  ])
  </code></pre>
  <p>When I run it I enter the following</p>
  <pre><code>xR1 = 2
  yR1 = 3
  
  xR2 = 2
  yR2 = 5
  
  xR3 = 4
  yR3 = 5
  
  xR4 = 4
  yR4 = 3
  </code></pre>
  <p>Yet I obtain the following error message:</p>
  <blockquote>
  <p>Error using <code>rectangle</code></p>
  <p>Can't specify convenience arg for this object</p>
  <p>Error in <code>script1</code> (line 37)</p>
  <p><code>rectangle('Position', min(XRcoordinates),min(YRcoordinates),width,height)</code></p>
  </blockquote>
  <p>What does the first error message mean?
  What is wrong?</p>