![]() |
如何在MATLAB中获取所有打开的图形的句柄
我在matlab中有9个打开的图形(由另一个函数生成),我想将它们全部打印到文件中。有谁知道如何抓住MATLAB中所有打开的图形的句柄?
我知道gcf但是它似乎并没有满足我的要求。 [B]回答:[/B] 有几种方法可以做到这一点。一种方法是获取[URL="https://www.mathworks.com/help/matlab/ref/groot.html"]根对象的[/URL]所有子[URL="https://www.mathworks.com/help/matlab/ref/groot.html"]对象[/URL] (在以前的版本中由句柄0 ): figHandles = get(groot, 'Children'); % Since version R2014b figHandles = get(0, 'Children'); % Earlier versions 或者您可以使用功能[URL="https://www.mathworks.com/help/matlab/ref/findobj.html"]findobj[/URL] : figHandles = findobj('Type', 'figure'); 如果任何图都有[URL="https://www.mathworks.com/help/matlab/ref/figure-properties.html#property_d0e277247"]隐藏的句柄[/URL] ,则可以改用[URL="https://www.mathworks.com/help/matlab/ref/findall.html"]findall[/URL]函数: figHandles = findall(groot, 'Type', 'figure'); % Since version R2014b figHandles = findall(0, 'Type', 'figure'); % Earlier versions [url=https://stackoverflow.com/questions/4540604]更多&回答...[/url] |
所有时间均为北京时间。现在的时间是 20:35。 |
Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.