Unfortunately, the first output of the function polyfit, being the coefficients of the fit changes, with the requested number of outputs. As an example:
x = 1:10 ;
y = 2*x + 3 ;
p1 = polyfit(x,y,1)
[p2, S] = polyfit(x,y,1)
[p3, S, mu] = polyfit(x,y,1)
This is only very cryptically mentioned in the documentation and is easily overlooked. I am not sure why this behaviour is implemented, but The Mathworks is likely to have its reasons ...
I suggest you to use the function fit to estimate the uncertainty in the parameters, as these are easy to retrieve. If you only need the coefficients, p = polyfit(x,y,n) will do, of course.