Effacer les filtres
Effacer les filtres

How to retrieve previousely created figures into a GUI

2 vues (au cours des 30 derniers jours)
Matt
Matt le 1 Mar 2016
Hello,
I know this has been a bit covered many times (I've had long searches and tests before posting this), but I cannot make this work. Basically I have a function activated by a pushbutton inside a GUI with nested loops, and inside these loops some figures are created automatically.
Once the function has ended I would like to use a popup menu to select which of these figures I would like to plot on an axes.
I've tried to save these figures to image files, and then just show these images on the axes object, but it doesn't work well because the figures have different sizes and proportions. So I've tried to work with .FIG files so it would resize things more or less automatically inside the figure to fit the available space, but no success.
How can I get around this problem?
Thanks!
EDIT: I not only need the data, but also the legends, axis labels, etc.

Réponses (2)

Walter Roberson
Walter Roberson le 1 Mar 2016
  6 commentaires
Matt
Matt le 7 Mar 2016
I am still struggling.
A=openfig('testfig.fig');
copyobj(A, uipanel(figure, 'Title', 'Panel 11', 'Units', 'pixels', 'Position', [0 0 800 600]));
It gives me the following error: Error using copyobj Figure parent must be the root.
When I just enter the 1st code line, then close the figure that appears and run the 2nd line, I get this error: Error using copyobj Copyobj cannot create a copy of an invalid handle.
It confuses me.
Walter Roberson
Walter Roberson le 7 Mar 2016
That's what the findall() is about, peeking into the figure to retrieve the objects that can be productively copied.

Connectez-vous pour commenter.


Jan
Jan le 1 Mar 2016
Note that data, axes labels and legends belong to the axes, not to the figure.
You cannot copy the contents of a figure to an axes object. What about keeping the figure as a figure in an own window? This would be rather direct and easy. The demand for saving a figure as an image file and have the ability to resize it dynamically is a contradiction. I think there will be a much easier approach.
You could use FEX: WindowAPI to create a borderless window and set its position automatically, such that it looks like it is embedded in the original figure. But I'd hesitate to implement such fancy tricks, because moving the original window will update the position of the embedded window with a certain delay only and this will cause optical illness. It is simply to ugly to be nice.

Catégories

En savoir plus sur Interactive Control and Callbacks dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by