When I create a three dimensional array and assign it to an undefined array, the assignment does not behave as I expect if the first two dimensions are singletons:
>> it = rand(1,1,3)it(:,:,1) = 0.9157it(:,:,2) = 0.7922it(:,:,3) = 0.9595>> vom(1,:,:) = itvom = 0.9157 0.7922 0.9595>> vom(:,1,:) = itvom = 0.2769 0.0462 0.0971
I know there are a million ways around this, but this behavior seems unnatural to me. Is this singleton dimension removal documented anywhere?
Best Answer