Problems with contour function: it doesn't work even matlab's examples

5 views (last 30 days)
I can't plot not one contour figure (matlab examples too). For example, when I typed:
>> [X,Y,Z] = peaks;
>> contour(X,Y,Z,20)
I obtained:
Error using message
Too many output arguments.
Error in contours (line 53) warning(message('MATLAB:contours:DeprecatedErrorOutputArgument', upper( mfilename )));
Error in specgraph.contourgroup/refresh (line 180) [this.contourmatrix,msg] = contours(x,y,z,levels);
Error in specgraph.contourgroup/schema>LdoDirtyAction (line 265) refresh(h);
I am working with Matlab R2011b in a Macbook pro. Thank you in advance for any help.
Carlos

Accepted Answer

Shashank Prasanna
Shashank Prasanna on 20 Jan 2013
Are you sure you are not using 'contours' instead of 'contour'. The error message you mentioned is part of 'contours.m' and not 'contour.m' as you show in your code. contours is undocumented not recommended for use.
If you feel there has been a path issue, I recommend you run:
>> restoredefaultpath
>> rehash toolboxcache
  4 Comments
Shashank Prasanna
Shashank Prasanna on 20 Jan 2013
Carlos, yes you are right you would lose all your paths if you ran that, but it would definitely fix issues if there were 3rd party toolbox conflicts. But I am glad it worked fine.
If you notice conflicts in the future, just run:
which -all filename
This will tell you all occurrences of that function, and you will be able to see where in the path they are stores so you can see if there is anything suspicious.
Image Analyst
Image Analyst on 20 Jan 2013
This is what I have:
>> which -all message
message is a built-in method % message constructor
C:\Program Files\MATLAB\R2012b\toolbox\shared\filterdesignlib\@FilterDesignDialog\message.m % FilterDesignDialog method
C:\Program Files\MATLAB\R2012b\toolbox\shared\spcuilib\@uiservices\message.m % uiservices method
C:\Program Files\MATLAB\R2012b\toolbox\signal\sigtools\@siggui\message.m % siggui method
C:\Program Files\MATLAB\R2012b\toolbox\matlab\lang\message.m % Shadowed
And the example works fine for me - no complaint about message's output arguments. Let us know if you have another message m-file somewhere. It seems you must. If you don't see anything different than what I put, then search your hard drive for message.m to find the guilty "message" function culprit.

Sign in to comment.

More Answers (0)

Categories

Find more on Contour Plots 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!