Getting axes labels as strings
1 次查看(过去 30 天)
显示 更早的评论
Is there a way to 'get' the axes label as strings instead of the default number that one receives when one uses 'get(h,'Xlabel')'. For example, if the xlabel was 'Pressure/kPa', is there a way to return this label (i.e. 'Pressure /kPa'). Many thanks.
0 个评论
采纳的回答
Star Strider
2014-9-9
This works:
x = linspace(0,10*pi,1000);
y = sin(2*pi*sin(x));
figure(1)
plot(x,y)
grid
axis tight
xlabel('Furlongs/Fortnight')
xlbl = get(get(gca,'XLabel'),'String')
produces:
xlbl =
Furlongs/Fortnight
2 个评论
Star Strider
2014-9-9
My pleasure!
The 'String' option is not prominently featured in the Axis Properties documentation. It should be.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Graphics Object Properties 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!