importing .fig to GUI
1 回表示 (過去 30 日間)
古いコメントを表示
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 件のコメント
回答 (2 件)
Titus Edelhofer
2011 年 7 月 15 日
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 件のコメント
Andrea Gil
2011 年 7 月 15 日
1 件のコメント
Titus Edelhofer
2011 年 7 月 15 日
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))
参考
カテゴリ
Help Center および File Exchange で Printing and Saving についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!