I have encountered something very strange. When I create a legend it is clearing my workspace. I don't remember ever seeing this before, could it be some setting that has been modified?
a=pi;
b='text';
fh=figure;
plot([1:10])
whos
lh=legend('test');
whos
gives the following output:
Name Size Bytes Class Attributes
a 1x1 8 double
b 1x4 8 char
fh 1x1 112 matlab.ui.Figure
Name Size Bytes Class Attributes
lh 1x1 112 matlab.graphics.illustration.Legend
I'm using R2014b on linux.
>> which -all legend
/toolbox/matlab/scribe/legend.m
>> ls -l /toolbox/matlab/scribe/legend.m
-r--r--r-- 1 admin grp 12345 Mar 5 2014 /toolbox/matlab/scribe/legend.m