How can I get mathematical expression output on Matlab app designer in pretty format

How can I get mathematical expression output on Matlab app designer in pretty format. I want d text field to display calculation results as x²instead of x^2

 Accepted Answer

You might need to do text analysis and substitution, such as
regexprep(S, {'\^2', '\^3'}, {char(178), char(179)})
In particular, uitextarea() does not support any Interpreter property at this time.
I am seeing contradictory material on whether text() supports interpreter latex in AppDesigner. The material that says it does work is newer than the material that says it does not work, so it might be the case that it was added in a more recent release.
If you are doing a symbolic calculation, you could experiment with latex() of the symbolic expression, and text() that into place on a graph (not a text area)

5 Comments

What does that mean text analysis do? I tried using latex interpreter to to text d expression to plot, but it keeps saying only character vector and string vector can be accepted
S = char(YourSymbolicExpression)
Now S is a character vector that you can analyze and modify.
You can also try
L = latex(YourSymbolicExpression) ;
text(x, y, L, 'interpreter', 'latex')
Notice that you do not ask to text YourSymbolicExpression itself.
It's giving me d expression in latex form Something like \sin(x^2) Instead of sin x²
L = latex(YourSymbolicExpression) ;
text(x, y, ['$' L '$'], 'interpreter', 'latex')

Sign in to comment.

More Answers (0)

Categories

Find more on Develop Apps Using App Designer in Help Center and File Exchange

Products

Asked:

on 14 Mar 2020

Commented:

on 20 Mar 2020

Community Treasure Hunt

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

Start Hunting!