After finding some logic in how empty structs are dealt with, I wanted to check how this generalized to matrices.
Here I noticed the following:
If you have a 1x1 matrix, and assign to the first element. It is not the same as assigning to all elements.
This rather surprised me as the first element is really the same as all the elements in this case. Here are my observations:
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(:,:) = []
After seeing this my question is:
Why does assigning to the same thing in different ways, lead to four different outcomes?