Pregunta

Tengo nueve figuras abiertas en Matlab (generada por otra función) y quiero imprimirlas todas a archivo. ¿Alguien sabe cómo agarrar los mangos de todos los datos abiertos en MATLAB?

Me sabe de gcf pero no parece hacer lo que quiera.

¿Fue útil?

Solución

Hay algunas maneras de hacer esto. Una forma de hacer esto es conseguir que todos los hijos de la objeto raíz (representada en las versiones anteriores por el 0 mango):

figHandles = get(groot, 'Children');  % Since version R2014b
figHandles = get(0, 'Children');      % Earlier versions

O usted podría utilizar la función findobj :

figHandles = findobj('Type', 'figure');

Si ninguna de las figuras tienen manijas ocultas , en su lugar puede utilizar la función de findall :

figHandles = findall(groot, 'Type', 'figure');  % Since version R2014b
figHandles = findall(0, 'Type', 'figure');      % Earlier versions

Otros consejos

One of the best things to do is to NOT need to look for the handles. When you create each figure, capture its handle.

h(1) = figure;
h(2) = figure;
...

As one of the developers here told me:

They are called handles, because you are supposed to hold on to them

I think findall should work

handles=findall(0,'type','figure')

You've get fine answers for the handles mass. But another tip for the original question- print all the figures to file: you can use publish option, without dealing with figrues or handles.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top