MATLAB: How to put function’s out put plot in Guide axes

figuregui

Hi all
I have a function which has a figure as output . now I'm trying to use this function as part of my GUI and i want to put this figure in axes of my GUI.thanks for any solotion.

Best Answer

Suppose your function produces the following figure
figure;
axHand = axes;
hold(axHand, 'on')
plot(rand(10));
plot(rand(10), 'o')
and your GUI figure axis is named 'guiAxisHandle'. To copy everything in 'axHand' to 'guiAxisHandle',
copyobj(axHand.Children, guiAxisHandle)
Now you can delete the orginal figure.
delete(axHand.Parent)