Why am I getting an error when using legend command

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

I can’t reproduce your error (R2014a). It works fine for me. You may want to Contact Support.
If this doesn't go away with a restart of Matlab submit bug report/service request at mathworks.com
That clearly is just a bug.
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).
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.
>>
In R2014a:
which flip -all
produces:
built-in (C:\Program Files\MATLAB\R2014a\toolbox\matlab\elmat\flip)

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

태그

질문:

2014년 6월 27일

댓글:

2014년 6월 27일

Community Treasure Hunt

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

Start Hunting!

Translated by