Error that makes no sense at all

Suddenly the histogram function doesn't generate plots. I tested it with this:
>> x = randn(10000,1);
>> h = histogram(x)
Error using histogram
Too many input arguments.
What gives?

6 Kommentare

What is the result of
which histogram
?
At a guess you have probably created your own function with that name
Stephen23
Stephen23 am 22 Feb. 2017
Bearbeitet: Stephen23 am 22 Feb. 2017
Better, because it shows shadowed functions:
which histogram -all
Adam
Adam am 22 Feb. 2017
True, although I tend not to suggest that since any not shown by the command without '-all' are hidden anyway so are not the active function.
John D'Errico
John D'Errico am 22 Feb. 2017
It is just personal preference though. Myself, I like the -all appendage, for what I consider a good reason. That makes it clear there still is a histogram function, but that it has been shadowed. It might help the user to understand what they have done.
In rare cases the difference might be important too, perhaps helping to track down the event someone has done something deviously bad, and overwritten the supplied version of histogram.m with their own code.
Stephen Thompson
Stephen Thompson am 23 Feb. 2017
Indeed I had something added to my path with a histogram.m in it.
Steven Lord
Steven Lord am 23 Feb. 2017
In that case, Adam can you submit your comment as an answer so Stephen can accept that answer and give you credit?

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Adam
Adam am 23 Feb. 2017

1 Stimme

What is the result of
which histogram -all
?
At a guess you have probably created your own function with that name

Tags

Gefragt:

am 22 Feb. 2017

Beantwortet:

am 23 Feb. 2017

Community Treasure Hunt

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

Start Hunting!

Translated by