画图问题:使用lgd=legend语句时,lgd被看作double类型而不是结构体。
1 view (last 30 days)
Show older comments
clear
clc
close all
x = linspace(0,pi);
y1 = cos(x);
plot(x,y1)
hold on
y2 = cos(2*x);
plot(x,y2)
lgd=legend('cos(x)','cos(2x)')
lgd.FontSize=13
%set(lgd,'FontSize',13)
使用lgd.FontSize=13来更改字体大小时报错:警告: 结构体字段赋值使用类 "double" 覆盖值。有关详细信息,请参阅 MATLAB R14SP2 发行说明中的“将非结构体变量指定为结构体时显示警告”。 并且无法更改字体大小,只能换用set(lgd,‘FontSize’,13)语句来更改。
通过查看工作区发现,lgd是一个double类型的数字,而不是结构体,自然无法通过 structName.fieldName的方式去访问FontSize,但是明明别人的示例程序可以用lgd.FontSize=13的方式来改字体,为啥我的就不行,我的版本是R2014a
0 Comments
Accepted Answer
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!