title: Difference between first element of 1x1 matrix and all elements of 1x1 matrix
body: <p>After finding some logic in <a href="https://stackoverflow.com/questions/16342688/difference-between-empty-matlab-struct-s-and-all-elements-s/18958834">how empty structs are dealt with</a>, I wanted to check how this generalized to matrices.</p>
  
  <p>Here I noticed the following: </p>
  
  <p>If you have a 1x1 matrix, and assign to the first element. It is not the same as assigning to all elements.</p>
  
  <p>This rather surprised me as the first element is really the same as all the elements in this case. Here are my observations:</p>
  
  <pre><code>x = 1;
  y = 1;
  z = 1;
  
  x(:) = []; % Evaluates to [] as I expected
  y(1) = []; % Evaluates to Empty matrix: 1-by-0, rather than []
  z(1,1) = []; %Throws an error: 'Subscripted assignment dimension mismatch.' even though size(z)  gives [1 1];
  z(1,:) = []; % Evaluates to Empty matrix: 0-by-1, just like z(:,:) = []
  </code></pre>
  
  <p>After seeing this my question is:</p>
  
  <p><strong>Why does assigning to the same thing in different ways, lead to four different outcomes?</strong></p>