I have program code in matlab with GUI. I have there some axes object called "axes1" - there my plot is displayed (simple plot of x, y values).
I want that after point on line there shows value of Y axis in that point. And best if it would display dynamically - after moving curosor the values would automatically show new pointed value.
I saw some tutorials about this, but I couldn't apply their tips to program with GUI.
Display value of Y axis inside GUI plot
344 views Asked by DzikiChrzan At
1
Here is a very simple example of a way you could use datacursormode, an interactive cursor which enables you to select points on your figure and get their coordinates. You could easily customize the example and store the coordinates in variables and so on, but I'll let this part up to you :).
Here is the code of the GUI with comments. You can copy/paste into a new .m file to test and play around. The GUI is just an axes in which I display random data and a checkbox that you can use to toggle the activation (i.e. on or off) of the
datacursormode
.Sample screenshot of the GUI after enabling the datacursormode and selecting a point on the curve:
Have fun!