Colorbar error "Too many input arguments." in matlab 2015b

2 views (last 30 days)
I am experiencing a problem with the colorbar function on matlab 2015b student version. Note this is a brand new installation on a new laptop running Windows 10 64bit (ie. I have no new functions that override the default ones as another question suggests). I have updated to my latest graphics drivers to no avail.
So the following code
figure
surf(peaks)
colorbar
produces the following error
Error using parula
Too many input arguments.
Error in matlab.graphics.illustration.ColorBar
Error in colorbar (line 174)
cbar = matlab.graphics.illustration.ColorBar;
Changing the colormap makes no difference. Changing the renderer to painters as well as using the software and hardware modes in opengl makes no difference. Also just typing
matlab.graphics.illustration.ColorBar
produces the same error (minus the bottom two lines). And for incase anyone wants
opengl info
outputs
Version: '4.5.0 NVIDIA 361.75'
Vendor: 'NVIDIA Corporation'
Renderer: 'GeForce 920M/PCIe/SSE2'
RendererDriverVersion: '10.18.13.6175'
RendererDriverReleaseDate: '22-Jan-2016'
MaxTextureSize: 16384
Visual: 'Visual 0x07, (RGBA 32 bits (8 8 8 8), Z depth 16 bits, Hardware acceleration, Double buffer, Antialias 8 samp…'
Software: 'false'
HardwareSupportLevel: 'basic'
SupportsGraphicsSmoothing: 1
SupportsDepthPeelTransparency: 0
SupportsAlignVertexCenters: 0
Extensions: {323x1 cell}
MaxFrameBufferSize: 16384

Accepted Answer

Walter Roberson
Walter Roberson on 10 Feb 2016
One thing I would try as an experiment would be
set(groot, 'DefaultFigureColormap', jet)
and see whether the problem is solved or if the problem transfers to 'jet'.
You could use
dbstop if error
to get it to stop when it fails the call to parula and see how it is trying to invoke it. There should be either 0 or 1 argument. If there is 0 or 1 argument already, then use
which -all parula
to see where it is getting the parula function... just in case somehow you are picking up (for example this version)

More Answers (1)

Mike Garrity
Mike Garrity on 10 Feb 2016
This bit of the message:
Error using parula
Too many input arguments.
Error in matlab.graphics.illustration.ColorBar
Error in colorbar (line 174)
cbar = matlab.graphics.illustration.ColorBar;
is coming from where the colorbar's ColorMap gets initialized to its default value.
It calls the function parula, with the argument 64 (meaning it wants 64 colors). The error is saying that the function parula doesn't expect an argument. That would imply that there's something named parula on your path. Could you do a "which"?
which parula -all
This should return something like this:
matlab/toolbox/matlab/graph3d/parula.m
If it doesn't then you need to look at the file it is pointing at.
  2 Comments
Rayko Stantchev
Rayko Stantchev on 10 Feb 2016
Yea both of you were correct!
The problem came from the fact that this package http://www.mathworks.com/matlabcentral/fileexchange/51986-perceptually-uniform-colormaps has parula and matlab was getting confused with the one from there.
Thank you!
Walter Roberson
Walter Roberson on 10 Feb 2016
Good thing you didn't have any new functions that override the default, or who knows what might have happened...

Sign in to comment.

Categories

Find more on Graphics Performance in Help Center and File Exchange

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!