show symbol in command window

34 visualizaciones (últimos 30 días)
armin
armin el 5 de Jul. de 2011
Editada: Walter Roberson el 5 de Ag. de 2025
Hello,
in Matlab i use \phi to display the greek letter phi; or x_t to display a subscript.
I use it in plots and it works. However in the command window i am not able to use it.
Is it possible or not?
armin
thank u
  2 comentarios
Muhammad Raheel
Muhammad Raheel el 25 de Feb. de 2023
Hello..My question is how to convert micro farad into farad tell me please
Walter Roberson
Walter Roberson el 25 de Feb. de 2023
Editada: Walter Roberson el 5 de Ag. de 2025

Iniciar sesión para comentar.

Respuesta aceptada

Walter Roberson
Walter Roberson el 25 de Feb. de 2023
Editada: Walter Roberson el 5 de Ag. de 2025
In the time since the question was originally asked, an additional possibility has arisen.
If you are using the Symbolic Toolbox inside LiveScript, and you use a symbolic variable name that is the English spelling of a Greek letter, then if you display the contents of an expression involving the variable, then the variable will be formatted as a symbol. This applies only to LiveScript and only to the content, not to the name of the variable holding the content.
syms theta(t)
theta_dot = sin(theta)^2
theta_dot(t) = 
syms phi_ddot
eqn = phi_ddot == sin(theta)^2
eqn(t) = 
the display of "theta_dot =" would be plain text and then the sin(theta)^2 would be nicely formatted. "theta_dot" would not be nicely formatted because... well, design decision really. But the display of eqn would display "eqn =" as plain text without trying to format it, but the phi_ddot is on the right side, part of the expression, so it would be nicely formatted. So in practice you can get both sides formatted if you make it an equality to be displayed.

Más respuestas (4)

Aider
Aider el 13 de Sept. de 2020
Editada: Walter Roberson el 13 de Sept. de 2020
You can use fprintf with unicode characters, the syntax is \xN, where N is the hex number that identifies the desired character.
Example:
fprintf(['degree plus_minus alpha beta epsilon rho \n', ' \xB0 \xB1 \x3B1 \x3B2 \x3B5 \x3C1 \n'])
degree plus_minus alpha beta epsilon rho
° ± α β ε ρ
Hope it helps.
  4 comentarios
Walter Roberson
Walter Roberson el 5 de Ag. de 2025
I did not give the link; I edited the response to format the code into a code box.
Walter Roberson
Walter Roberson el 5 de Ag. de 2025
Note that at the ttime the question was originally asked in 2011, using unicode characters would not generally work. It would have been more likely to work on MacOS or Linux, but would fail most of the time on Windows.

Iniciar sesión para comentar.


Slerotin
Slerotin el 12 de Mayo de 2017
You can use "char(XXX)" with the XXX being the number for the character, such as char(951) for eta.

Paulo Silva
Paulo Silva el 5 de Jul. de 2011
Unfortunatly it's not possible

Richard Muchiri
Richard Muchiri el 26 de Abr. de 2021
Try using the html with %s to detect.
charlambda=char(955);
lambda_string=(num2str(charlambda));
amp = sprintf('Enter the amplitude,%s ',lambda_string);
  2 comentarios
Walter Roberson
Walter Roberson el 26 de Abr. de 2021
amp = sprintf('Enter the amplitude,%c ', 955);
Richard Muchiri
Richard Muchiri el 26 de Abr. de 2021
Thanks. Really short and efficient

Iniciar sesión para comentar.

Categorías

Más información sobre Characters and Strings en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by