Error updating Legend. Simple script throws an error/warming

1 次查看(过去 30 天)
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 个)

类别

Help CenterFile Exchange 中查找有关 Legend 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by