title: MATLAB: taking the average of two numbers in a list?
body: <p>i'm trying to write a script that takes the average of the first two numbers and produces a new list.</p>
  
  <p>for example, if i have </p>
  
  <p>a = [1,2,3,4], i want it to produce b = [1.5, 2.5, 3.5
  ] </p>
  
  <p>is there anyway of adding the two endpoints in to the loop? So far, I have:</p>
  
  <pre><code>for i=1:m
      betwn(i) = (values(i) + values(i+1))/2 %values is a list
      if i = m
          break
      end
  end
  </code></pre>
  
  <p>and it doesn't seem to be working well...</p>
  
  <p>Thanks!!</p>