Error updating Legend. Simple script throws an error/warming
2 views (last 30 days)
Show older comments
Hello, I'm trying modify the position and thick of the legend after was created. In this script:
clearvars
close all
clc
x=rand(1,10);
h=plot(x);
hold on
[hL,obj,outh]=legend(h,'Rand x');
set(hL,'Position',[0.3 0.8 0.06 0.05])
The last line throws this warning:
Warning: Error updating Legend.
Struct contents reference from a non-struct array object.
But, the following lines doesn't throws the warning:
hL=legend(h,'Rand x');
set(hL,'Position',[0.3 0.8 0.06 0.05])
I'm changing the propierties whit the outh handles, so I have to use the 3 outputs. Itself is not a problem, and the script does all is supposed to do. Any ideas to avoid the warning? or may be is a bug. Thank you to all.
0 Comments
Answers (0)
See Also
Categories
Find more on Legend 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!