How to display square root symbol instead of decimal.

The number of display format does not include the square, I can only select decimal, rational..., but not square root. When I input sqrt(5) in a matrix and display it, it is transformed to decimal. Can I keep the square root form?

3 comentarios

KSSV
KSSV el 31 de En. de 2023
Where you want to display it?
Botlhe
Botlhe el 10 de Feb. de 2026
Command window
Walter Roberson
Walter Roberson el 10 de Feb. de 2026
Editada: Walter Roberson el 10 de Feb. de 2026
To display at the command line, you would need to be using a matlab version from the last several years, and you would need to fprintf the unicode square root symbol, √ which is U+221A, followed by whatever text. This would prefix the text with the symbol rather than drawing the symbol extending over the text. There is no way to get the symbol extending over the text at the command line.
If you use the symbolic toolbox together with Livescript then it does become possible to display the square root extending over the text... but not at the command line.

Iniciar sesión para comentar.

 Respuesta aceptada

sqrt(sym(5))
ans = 
This requires the Symbolic Toolbox.
Also, display of the square root symbol itself instead of 5^(1/2) requires that you are using Livescript

Más respuestas (0)

Categorías

Más información sobre Symbolic Math Toolbox en Centro de ayuda y File Exchange.

Preguntada:

el 31 de En. de 2023

Editada:

el 10 de Feb. de 2026

Community Treasure Hunt

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

Start Hunting!

Translated by