importing .fig to GUI
4 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hi!
I have a problem with Matlab GUI and I would appreciate it if somebody could help me.
I have designed a program that calculates a diagram and some values. I have different ways to get the diagram:
1)by calculating vectors in the m-file of the GUI and plotting them on the axes of GUI
2) by loading an image on the axes,
3) by loading there a saved in .fig plot from matlab.
For this last case, I have tried everything to locate the .fig on the axes of the GUI, but I don't manage to do it. I get the plot, but it is shown on a new image window. Could anybody please help me? Thanks! :)
0 Commenti
Risposte (2)
Titus Edelhofer
il 15 Lug 2011
Hi,
usually I would prefer option one. But if you want to go for three, you might do the following:
hFigure = openfig('yoursavedfigure.fig', 'new', 'invisible');
% assuming there is only one axes in your stored figure:
hAxes = get(hFigure, 'CurrentAxes');
% assuming we are in a callback and the tag of your figure is figure1:
hCopy = copyobj(hAxes, handles.figure1);
set(hCopy, 'Position', 'where it shoud be in your GUI')
Titus
0 Commenti
Andrea Gil
il 15 Lug 2011
1 Commento
Titus Edelhofer
il 15 Lug 2011
Hi Andrea,
yes: when you open guide, and you added somewhere in your gui an axes object, then double click on it and you see the position (and the units, they have to be the same or set before the position). Then remove the axes from your GUI and try to run the code above (or modify the code: handles.axes2 = copyobj(...); delete(handles.axes1))
Vedere anche
Categorie
Scopri di più su Printing and Saving in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!