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

조회 수: 42 (최근 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 CenterFile Exchange에서 Graphics Object Properties에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by