zoukankan      html  css  js  c++  java
  • Matlab之findobj()

    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])

  • 相关阅读:
    python基础易错题
    经典案例题2
    经典案例题1
    Http和Https的区别
    爬虫过程中需要注意的问题
    [转]项目规模估计方法介绍
    [转]23种设计模式总结
    [转]分布式session的几种实现方式
    [转]Redis哨兵模式(sentinel)学习总结及部署记录(主从复制、读写分离、主从切换)
    [转]【Linux】Linux 目录结构
  • 原文地址:https://www.cnblogs.com/yaochc/p/3437646.html
Copyright © 2011-2022 走看看