I am puzzled by the following:
A(1,:) = zeros(1,1,5); % 1x5
A(1,:) = zeros(1,1,1,5); % 1x5
A(1,:) = zeros(1,1,1,1,5); % 1x5
The leading singleton dimensions get ignored.
A(:,1) = zeros(1,1,5); % 5x1
A(:,1) = zeros(1,1,1,5); % 5x1
A(:,1) = zeros(1,1,1,1,5); % 5x1
Now there seems to be a transposition on top of the dimensions being ignored.
A(1,:,:) = zeros(1,1,5); % 1x5
A(1,:,:,:) = zeros(1,1,5); % 1x1x1x5
A(1,:,:,:,:) = zeros(1,1,5); % 1x5
The trailing colons seem to get ignored until the left-hand side asks for 1 more dimension than the right-hand side.
A(:,:,1) = zeros(1,1,5); % 5x1
A(:,:,:,1) = zeros(1,1,5); % 1x1x5
A(:,:,:,:,1) = zeros(1,1,5); % 5x1
The leading colons seem to get ignored until the same situation presents itself.
I do see a pattern, but I am confused and I am not sure I could anticipate the behaviour of more complex code. What is the logic behind this?