Making a duplicate plot from a GUI axis in a normal figure window with a pushbutton

1 view (last 30 days)
I have a GUI made with Guide, in MATLAB 2013b. It has two axes in it and two buttons, which I would like, when pressed, to pop-out/duplicate each of the axes into a figure window. What confuses me is that I can make one of the buttons work and not the other. What I have is:
For the left button (this one works):
L = handles.MZILeft;
h = figure;
copyobj(L,h);
For the right button (this one does not work):
R = handles.MZIRight;
h2 = figure;
copyobj(R,h2);
Each of these sets of code are in the callback functions of two push buttons. MZILeft and MZIRight are the tags to the axes. I know the handles to the axes are correct because I successfully plot to them. The right button does not give an error, it just makes a blank figure. I tried changing the order the figures in the GUI were created, but that didn't change anything. I also tried,
copyobj(get(R,'parent'),h2);
But that unsurprisingly gave a figure with both figures in it because the figures are both in a panel together.
Am I doing something silly here? Thanks

Answers (0)

Categories

Find more on Graphics Object Programming in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!