MATLAB: Error while using colorbar command in MATLAB 2020a on Windows 10!

colorbarMATLABmatlab2020a

[X,Y] = meshgrid(1:0.5:10,1:20);
Z = sin(X) + cos(Y);
C = X.*Y;
surf(X,Y,Z,C)
colorbar
If I run the following code, then I am getting the following errors.
Error using flip
Too many input arguments.
Error in flipud (line 14)
x = flip(x,1);
Error in matlab.graphics.shape.internal.AxesLayoutManager/insertAboveAxes
Error in matlab.graphics.shape.internal.AxesLayoutManager.getManager
Error in legendcolorbarlayout (line 27)
hManager = matlab.graphics.shape.internal.AxesLayoutManager.getManager(hAx);
Error in matlab.graphics.illustration.ColorBar/setAxesImpl
Error in matlab.graphics.illustration.ColorBar/set.Axes_I
Error in matlab.graphics.illustration.ColorBar/set.Axes
Error in colorbar (line 238)
cbar.Axes = peeraxes;
Basically colorbar command is giving the error.
Please help. Thanks a lot in advance.

Best Answer

which -all flip
is likely to indicate that you have your own function or a third party function by that name instead of the built-in function