MATLAB Answers

How to print mathematical equations in menu

1 view (last 30 days)
Thai Tran
Thai Tran on 29 Dec 2020
Commented: Walter Roberson on 29 Dec 2020
I'm having trouble with how to print mathematical equation in menu:
Here's my code:
choice = menu("I want to print equation here", 'Plot trajectory', 'Calculate acceleration');
And this is equations i want to print:
x = 3*t - t^3
y = 4*t^2
Any idea how to do this? Thank you very much
  1 Comment
Walter Roberson
Walter Roberson on 29 Dec 2020
Do they need to be formatted somehow, such as raised exponent? If so then that cannot be done with menu(). Also line break cannot be done with menu()

Sign in to comment.

Answers (1)

Les Beckham
Les Beckham on 29 Dec 2020
I expect that what you want is not as simple as this, but as an initial guess at what you are looking for, try this.
I don't believe that you can get pretty LaTex equations in a menu.
choice = menu(sprintf('%s\n%s', 'x = 3*t - t^3', 'y = 4*t^2'), 'Plot trajectory', 'Calculate acceleration')

Community Treasure Hunt

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

Start Hunting!