How do I load a fig file into a GUI?

Dear all,
I have created a very simple GUI: one push button and one axes. When I press the push button, I want to open a dialog box, select a *.fig file and load it into the axes.
So, here is the piece of code I have in the callback of my push button:
[handles.my_file_name, handles.my_pathname]=uigetfile('C:\Users\Matlab\data_examples\*.fig','Select the figure file');
axes(handles.myPlot1); %myPlot1 is the name of my axes
openfig(handles.my_file_name);
When I run it, it opens the figure outside the my GUI. It loads it in a new figure.
I guess I'm missing something quite simple there, but I cannot figure it out. I would appreciate any help.
-Bests -

1 Comment

A .fig contains a figure. You can't load a figure into an axes or indeed anywhere into another figure.

Sign in to comment.

Answers (0)

Categories

Find more on Interactive Control and Callbacks in Help Center and File Exchange

Asked:

on 3 Aug 2016

Commented:

on 3 Aug 2016

Community Treasure Hunt

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

Start Hunting!