MATLAB Answers

How to get the title to change on a graph when on the menu function a different item is chosen

14 views (last 30 days)
Alex Doan
Alex Doan on 7 Feb 2020
Commented: Ajay Pattassery on 11 Feb 2020
location_menu= menu('please select a location data to plot',LocationID);
grid on
I want it to change the title for when a different locationID is chosen the title location will change
for example i choose new york a data graph of new york loads and the title says 'location newyork over time'.
then when i click texas a graph data of texas whill show up witht the title 'location texas over time'.


Show 3 older comments
Adam Danz
Adam Danz on 7 Feb 2020
When you're using a menu to select something that will change an object on the plot, the methods are the same wether you're changing a title, color, the data being plotted, etc. menu() outputs an index of your selection. That index is used to select an option stored in an array. That array could contain a list of titles, a list of data to plot, a list of colors, etc.
Part of the reason you get incomplete answers in this and the other quesiton is because you aren't providing much information in you question which is fine. The other reason is so you can learn an approach that you can apply to your needs. It's not rewarding to do other people's projects for them; but it is rewarding to help someone else learn; at least for me.

Sign in to comment.

Answers (0)


Community Treasure Hunt

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

Start Hunting!