如何检查图形是否打开以及如何将其关闭? [英] How to check if a figure is opened and how to close it?

查看:49
本文介绍了如何检查图形是否打开以及如何将其关闭?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的m文件根据参数打开数字.有时是一个数字,有时会打开2个数字.

My m-file opens figures depending on parameters. Sometimes is one figure, sometimes it opens 2 figures.

如果用户调用该功能,则会出现数字.如果他再次调用该函数以及其他参数,那么我将在新图之前使用clf清除图形.

If the user call the function, the figures appear. If he calls the function again, with other parameters, I'm clearing figures with clf before the new plots.

如果第二个调用设置为仅绘制一个图形,则第二个(由上一个调用打开)保持灰色(由于clf).

If the second call is set to draw only one figure, the second one (opened by the previous call) remain gray (because of the clf).

有什么方法可以检查它是否已打开并关闭?

Is there any way to check if it is opened and close it?

推荐答案

close all

将关闭所有未完成的数字.

Will close all open figures.

您可以使用findobj()通过指定搜索参数来查找可能存在的对象.例如:

You can use findobj() to find objects that may exist by specifying search parameters. For example:

figure('name','banana')

创建一个名称为香蕉的图形.

Creates a figure with the name banana.

close(findobj('type','figure','name','orange'))

不执行任何操作,因为没有打开带有橙色名称的数字.

Does nothing because there are no figures open with the name orange.

close(findobj('type','figure','name','banana'))

关闭图形.

您可以指定搜索参数来满足您的需求.

You can specify search parameters to meet your needs.

这篇关于如何检查图形是否打开以及如何将其关闭?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆