필터 지우기
필터 지우기

interpreter with backlash underscores

조회 수: 5 (최근 30일)
Adam Jurhs
Adam Jurhs 2022년 5월 13일
댓글: Voss 2022년 5월 13일
hi guys,
i have a csv file that has some underscores in the strings that i use as xticklabels. i understand the the interpreter will interpret underscores to be use the following text as subscript unless you put a backslash in front of the underscore. sometimes this works perfectly other times it doesn't, see example:
abc\_def -> abc_def as it's supposed to other times it gives me abc\_def -> abc\_def keeping the backslash as part of the string
any ideas

채택된 답변

Voss
Voss 2022년 5월 13일
The easiest way to fix this might be not to use an interpreter:
subplot(2,1,1)
xlim([-1 1])
set(gca(),'XTick',0,'XTickLabels','abc_def')
xax = get(gca(),'XAxis');
title(sprintf('Interpreter: %s',get(xax,'TickLabelInterpreter')));
subplot(2,1,2)
xlim([-1 1])
set(gca(),'XTick',0,'XTickLabels','abc_def')
xax = get(gca(),'XAxis');
set(xax,'TickLabelInterpreter','none')
title(sprintf('Interpreter: %s',get(xax,'TickLabelInterpreter')));

추가 답변 (1개)

Adam Jurhs
Adam Jurhs 2022년 5월 13일
gotcha, thanks!
  댓글 수: 2
Adam Jurhs
Adam Jurhs 2022년 5월 13일
wow! i didn't know i could run MATLAB code inside of this website. now i can post my question more specifically
Voss
Voss 2022년 5월 13일
Yeah, it's pretty cool what MathWorks has put together for us here.
Modify your question as necessary, to demonstrate the problem, and I'll modify my answer to address it if I can.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by