フィルターのクリア

Getting axes labels as strings

2 ビュー (過去 30 日間)
Oyeniyi
Oyeniyi 2014 年 9 月 9 日
コメント済み: Star Strider 2014 年 9 月 9 日
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.

採用された回答

Star Strider
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 件のコメント
Oyeniyi
Oyeniyi 2014 年 9 月 9 日
Thanks.
Star Strider
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 ExchangeGraphics Object Properties についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by