How can I open a specific figure from 'file.fig'?

4 visualizaciones (últimos 30 días)
Riyadh Muttaleb
Riyadh Muttaleb el 3 de Jun. de 2016
Comentada: Walter Roberson el 4 de Jun. de 2016
I have 'file.fig' contains about 500 figures I would like to open just one specific figure like number 200, without open all, How can I do that?
Thanks in advance,
Riyadh
  5 comentarios
Riyadh Muttaleb
Riyadh Muttaleb el 3 de Jun. de 2016
Editada: Riyadh Muttaleb el 3 de Jun. de 2016
Hello Walter, thank you for your response. I would like to open not save.
Walter Roberson
Walter Roberson el 4 de Jun. de 2016
I was replying to Azzi showing how it is possible to save multiple figures in the same .fig

Iniciar sesión para comentar.

Respuestas (1)

Walter Roberson
Walter Roberson el 3 de Jun. de 2016
I have just gone through the code, and the answer is NO.
Loading a .fig file is done by using load() on the .fig file, which is really a .mat file in disguise. The load() is the built-in routine that cannot be accessed, and it goes through and recreates all of the figures. It does this in the course of loading a single structure. In current .fig files, the structure name is hgM_070000 where the number might be different for older versions (it is a MATLAB version number); for some older .fig files, the structure name is hgS followed by a version number. One of the graphics objects stored in a field has the figures stored in it.
I thought about the possibility of using matFile to be selective about what is loaded from the .fig file, but you might recall that matFile does not allow one to be selective about which fields of a structure are loaded.
The closest that I can see to do: in R2014b or later, if you add an InstanceCreated listener to the metaclass of matlab.ui.Figure then the listener will fire for each figure created; you could potentially check each one as it was created and delete each if it wasn't the one you were interested in (though clearing it instead of deleting it might be needed to have everything else work out.)

Categorías

Más información sobre File Operations en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by