title: The meaning of colon operator in MATLAB
body: <p>I came across some MATLAB syntax with a colon that I don't fully understand. </p>
  
  <h3>First Question:</h3>
  
  <p>The expression: <code>0:pi/4:pi</code>
  results in the answer: <code>0    0.7854    1.5708    2.3562    3.1416</code></p>
  
  <p>Why is this the case? I thought that colon operator is used as a quick way to refer to indices so that we don't have to write out the full list. (e.g. <code>1:3</code> -> <code>1 2 3</code>)</p>
  
  <h3>Second Question:</h3>
  
  <p>Similar to above, say if I have a matrix <code>X = [1 2 3 4 5 6 7 8 9]</code>. How can I interpret the expression <code>X(:,1:3)</code>? Specifically, what does the colon operator without the left and right numbers mean? </p>