필터 지우기
필터 지우기

How to write an exponent in an axis label when the matlab syntax doesn't work?

조회 수: 12 (최근 30일)
The matlab syntax for writing an exponent in an axis label is
ylabel('e^t')
but when I try to do this on my figure I get the following error:
>> ylabel('e^t')
Warning: Error updating Text.
String scalar or character vector must have valid interpreter syntax:
e^t
Instead of getting an exponent, my axis label shows 'e^t' How do I resolve this issue?
  댓글 수: 8
Stephen23
Stephen23 2024년 1월 22일
ylabel('e^t')
What MATLAB version are you using?
Please show the exact code that you are calling.
Please show the complete output of this command:
which ylabel -all
Steven Lord
Steven Lord 2024년 1월 22일
이동: Dyuman Joshi 2024년 2월 25일
Do you receive that error running just that one line of code? Or can you only reproduce it with more lines (hopefully just a few lines)? Please post a small and self-contained example that you can run (in a fresh session of MATLAB, newly started) that produces the warning.
xlabel('e^{(t/10)}')
The one thing I'm thinking of that might cause this with just that line of code is if you've change the default Interpreter property for text objects first.
f = figure;
set(f, 'DefaultTextInterpreter', 'LaTeX')
xlabel('e^{(t/10)}')
Warning: Error updating Text.

String scalar or character vector must have valid interpreter syntax:
e^{(t/10)}
In that case try wrapping that label text in $.
f = figure;
set(f, 'DefaultTextInterpreter', 'LaTeX')
xlabel('$e^{(t/10)}$')

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

답변 (1개)

Brianna Miranda
Brianna Miranda 2024년 1월 22일
이동: Dyuman Joshi 2024년 2월 25일
I decided to just uninstall and reinstall matlab and that fixed the problem

카테고리

Help CenterFile Exchange에서 Axis Labels에 대해 자세히 알아보기

제품


릴리스

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by