• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Matlab之findobj()

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

findobj

findobj:特殊属性的图形对象

 

语法:

1.findobj:

findobj返回根对象的句柄和所有子对象(findobj returns handles of the root object and all its descendants without assigning the result to a variable.)


2.h = findobj:

返回根对象的句柄和所有子对象


3.h = findobj(\'PropertyName\',PropertyValue,...)

返回所有属性名为‘PropertyName’,属性值为\'PropertyValue\'的图形对象的句柄。可以指定多个属性/值对。


4.h = findobj(\'PropertyName\',PropertyValue,\'-logicaloperator\', PropertyName\',PropertyValue,...)

 

-logicaloperator可以取值:

-and

-or

-xor

-not


5.h = findobj(\'-regexp\',\'PropertyName\',\'regexp\',...)

属性名可以使用正则表达式

6.h = findobj(\'-property\',\'PropertyName\')

如果存在‘PropertyName’这个属性名,就返回此图形句柄

7.h = findobj(objhandles,...)

限制搜索范围为objhandles和他们的子图中


8.h = findobj(objhandles,\'-depth\',d,...)

指定搜索深度,深度参数\'d\'控制遍历层数,d为inf表示遍历所有层,d为0等同d=\'flat\'


9.h = findobj(objhandles,\'flat\',\'PropertyName\',PropertyValue,...)

 \'flat\'限制搜索范围只能是当前层,不能搜索子图。

如果句柄指向一个不存在的图形,findobj返回一个错误。

findobj正确匹配任何合法属性值,例如:

findobj(\'Color\',\'r\')

找到所有color值为红的对象。

为了寻找满足指定条件的额handle对象,我们可以使用handle.findobj。

 

例子:

在当前坐标下查找所有直线对象:
h = findobj(gca,\'Type\',\'line\')  %gca为当前坐标的句柄
 

查找Label属性设为\'foo\'和String设为\'bar\'的所有对象:
h = findobj(\'Label\',\'foo\',\'-and\',\'String\',\'bar\');
 

查找String不为\'foo\'也不为\'bar\'的所有对象:

h = findobj(\'-not\',\'String\',\'foo\',\'-not\',\'String\',\'bar\');
 

h = findobj(\'String\',\'foo\',\'-and\',\'Tag\',\'button one\',...
 \'-and\',\'-not\',{\'Color\',\'red\',\'-or\',\'Color\',\'blue\'})
 

Find all objects for which you have assigned a value to the Tag property (that is, the value is not the empty string \'\'):
h = findobj(\'-regexp\',\'Tag\',\'[^\'\']\')
 

Find all children of the current figure that have their BackgroundColor property set to a certain shade of gray ([.7 .7 .7]). This statement also searches the current figure for the matching property value pair.
h = findobj(gcf,\'-depth\',1,\'BackgroundColor\',[.7 .7 .7])


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
DELPHI7全套传世源码20000出发布时间:2022-07-18
下一篇:
Delphi-程序运行时不显示主窗体发布时间:2022-07-18
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap