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

1 view (last 30 days)
location_menu= menu('please select a location data to plot',LocationID);
graph1=Ice(:,location_menu)
plot(Days,graph1,'ro');
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'.
  6 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)

Categories

Find more on 2-D and 3-D Plots in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!