Is it possible to use a comma as decimal seperator in figures?

39 ビュー (過去 30 日間)
Robert Berghaus
Robert Berghaus 2017 年 11 月 3 日
コメント済み: Robert Berghaus 2017 年 11 月 3 日
A few years ago it was not possible to change the decimal seperator from dot to comma. Has this changed? I only need the comma in figures (as axis description in plots). Do you have any idea?
  2 件のコメント
Rik
Rik 2017 年 11 月 3 日
If you don't need them to be dynamic, you can change the dots to commas with get, strrep and set. Otherwise, this might be possible in HG2 (R2014b and later), but I don't know about it.
(maybe it is even possible to set your string replacer as the ResizeFcn, so it is run every time you resize the figure window.)
Robert Berghaus
Robert Berghaus 2017 年 11 月 3 日
編集済み: Robert Berghaus 2017 年 11 月 3 日
Yes it doesn't need to be dynamic and I have Matlab R2017a. But how can I change the axis with strrep?
x = -1:0.1:1;
y = x.^3;
figure;
plot(x, y);
ylabel('y=x^3');
xlabel('x');
newStr = strrep(gca,'.','.')

サインインしてコメントする。

採用された回答

KL
KL 2017 年 11 月 3 日
編集済み: KL 2017 年 11 月 3 日
try this,
xl = get(gca,'XTickLabel');
new_xl = strrep(xl(:),'.',',');
set(gca,'XTickLabel',new_xl)

その他の回答 (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