Why am I getting an error when using legend command
Show older comments
After installing R2014a, I have a consistent problem with functions and scripts that have worked in the past, specifically with the "legend" function. As an example, I wrote a simple script:
t = 0:.1:100;
x = [0:.1:100];
plot(t,x)
legend('y');
It produces the following error:
Error using flip
Too many input arguments.
Error in flipud (line 14)
x = flip(x,1);
Error in get_legendable_children (line 61)
ch = flipud(legkids(goodkid));
Error in graph2dhelper (line 31)
[varargout{1:nargout}] = feval(varargin{:});
Error in legend>make_legend (line 350)
children = graph2dhelper ('get_legendable_children', ha);
Error in legend (line 284)
[h,msg] = make_legend(ha,varargin(arg:end));
Error in Test (line 6)
legend('y');
5 Comments
Star Strider
on 27 Jun 2014
I can’t reproduce your error (R2014a). It works fine for me. You may want to Contact Support.
dpb
on 27 Jun 2014
That clearly is just a bug.
Geoff Hayes
on 27 Jun 2014
The error being raised here is identical to that from profiler error with flip. The problem there was that there existed a custom flip function that was interfering with the MATLAB built-in one.
In the Command Window, type
which flip -all
and check the results. If a custom version of flip does exist, it will appear in this list (and so need to be renamed).
dpb
on 27 Jun 2014
Ewww...Matlab namespace pollution strikes again! Soon there won't be any names left to use as TMW continues to introduce new stuff...
>> which flip
'flip' not found.
>>
Star Strider
on 27 Jun 2014
In R2014a:
which flip -all
produces:
built-in (C:\Program Files\MATLAB\R2014a\toolbox\matlab\elmat\flip)
Answers (0)
Categories
Find more on Legend in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!