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

조회 수: 5 (최근 30일)
Riyadh Muttaleb
Riyadh Muttaleb 2016년 6월 3일
댓글: Walter Roberson 2016년 6월 4일
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
Riyadh Muttaleb
Riyadh Muttaleb 2016년 6월 3일
편집: Riyadh Muttaleb 2016년 6월 3일
Hello Walter, thank you for your response. I would like to open not save.
Walter Roberson
Walter Roberson 2016년 6월 4일
I was replying to Azzi showing how it is possible to save multiple figures in the same .fig

댓글을 달려면 로그인하십시오.

답변 (1개)

Walter Roberson
Walter Roberson 2016년 6월 3일
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.)

카테고리

Help CenterFile Exchange에서 File Operations에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by