How do I plot data from one gui on another gui?

3 views (last 30 days)
Hello,
For starters I have two gui's. The first gui displays a plot on an axis, and the second gui has a variety of push buttons. Each of these push buttons has a value, and I want to display a vertical line that goes from "y1 = 0" and "x1 = 0" to "y2 =10" and "x2 = the push button value". I am wondering how to send the name of the axis on the first gui to the second gui, and then allow the second gui to plot on the first gui.
Also I want to be able to click on multiple push buttons and have them display a line on the same figure. If there is a simple way to do this I would be much obliged. Thank You -Eric

Accepted Answer

Image Analyst
Image Analyst on 9 Feb 2013
Why not combine them all in one single GUI? Otherwise, see the FAQ: http://matlab.wikia.com/wiki/FAQ#How_can_I_share_data_between_callback_functions_in_my_GUI.28s.29.3F
  2 Comments
Eric
Eric on 11 Feb 2013
Thanks very much for the link! Also I would like to make two different GUI's, because I want multiple figures. However if there is a way to produce multiple figures in the same GUI I would be more than relieved to do it that way.
I looked into the link you sent me, and it helped very much! I have one more question however. I have a push button in the main figure that calls on the 2nd GUI, and when I click on the push button in the 2nd GUI I send a value as the output to the first GUI. This works great, but I want to be able to push a second button within the 2nd GUI and have that change the output in the first GUI. I found that when I click on the second button nothing happens, and in order to retrieve the second value I need restart by clicking on the button in the main GUI. Is there a way to allow the user to continuously send data from one GUI to another without needing to click both push buttons?
Thank You, -Eric
Image Analyst
Image Analyst on 11 Feb 2013
It's these kind of complications why I never do multiple separate figures in my GUIs. All my GUIs are a single figure. I'm not sure what you mean when you say "if there is a way to produce multiple figures in the same GUI I would be more than relieved to do it that way." That's the way you're doing it now. Your GUI is composed of multiple, separate figures, where it's difficult to communicate between them because they ARE separate. Did by chance you mean axes instead of figures? I don't like having separate figures in my GUI because sometimes some of the figures get obscured by other windows and they can be moved around to all kinds of crazy positions that don't make sense, and it's hard to communicate between them because they don't have each others variables, yet you want to control one figure from another so it's those variables that you need. Anyway, if you're going to do it the hard way, you're on your own because I do it the easy way, and am not that familiar with the hard way.

Sign in to comment.

More Answers (0)

Categories

Find more on Graphics Objects 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!