获取0(根对象)的所有属性(包括隐藏的属性) [英] Getting all of the properties (Including the hidden ones) of 0 (The root object)

查看:105
本文介绍了获取0(根对象)的所有属性(包括隐藏的属性)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

似乎根对象a.k.a 0在Matlab中具有隐藏的属性.例如,DefaultTextInterpreter是其中之一:

It seems that the root object, a.k.a 0 has hidden properties in Matlab. For example, DefaultTextInterpreter is one of them:

 x = get(0,'DefaultTextInterpreter');

当我使用

 get(0)

我得到一长串,没有包括DefaultTextInterpreter.

I get a long list, which does not include DefaultTextInterpreter.

即使将未记录的属性设置为

Even setting undocumented properties to be visible by

 set(0,'HideUndocumented','off');

似乎没有帮助.

如何找到根对象的所有属性,包括DefaultTextInterpreter?

How can I find all of the properties of the root object, including DefaultTextInterpreter?

推荐答案

默认属性未隐藏也未记录-通过在属性名称前加上'Default'以及对象类型,即可将它们用于所有标准Handle Graphics属性. (线",轴"等). 官方文档中对此进行了说明.

Default properties are not hidden nor undocumented - they are available for all standard Handle Graphics properties by simply prefixing 'Default' to the property name, together with the object type ('Line', 'Axes' etc.). This is explained in the official documentation.

实际上,此机制还适用于隐藏/未记录的属性,如所示用于LineSmoothing属性.

In fact, this mechanism also works for hidden/undocumented properties, as shown for the LineSmoothing property.

要查看所有受支持的默认属性,请执行以下操作:

To see all the supported default properties, do as follows:

>> get(0,'Default')
ans = 
          defaultFigurePosition: [440 378 560 420]
               defaultTextColor: [0 0 0]
              defaultAxesXColor: [0 0 0]
              defaultAxesYColor: [0 0 0]
              defaultAxesZColor: [0 0 0]
          defaultPatchFaceColor: [0 0 0]
          defaultPatchEdgeColor: [0 0 0]
               defaultLineColor: [0 0 0]
    defaultFigureInvertHardcopy: 'on'
             defaultFigureColor: [0.8 0.8 0.8]
               defaultAxesColor: [1 1 1]
          defaultAxesColorOrder: [7x3 double]
          defaultFigureColormap: [64x3 double]
        defaultSurfaceEdgeColor: [0 0 0]
         defaultFigurePaperType: 'A4'
        defaultFigurePaperUnits: 'centimeters'
         defaultFigurePaperSize: [20.98404194812 29.67743169791]

请注意,这不会返回未记录的默认值.您始终可以直接获得未记录的默认值:

Note that this does not return the undocumented defaults. You can always get the undocumented defaults directly:

>> get(0,'DefaultLineLineSmoothing')
ans =
off


由于我无法帮助自己:-),因此,这里有一些目前尚未真正记载的知识,它不能回答OP问题,但在某种程度上是相关的.仅对原始问题或纯文档/支持的内容感兴趣的读者可以安全地跳过此部分:


Since I can't help myself :-), here's a bit of now-really-undocumented knowledge, which does not answer the OP question but it somehow related. Readers who are only interested in the original question or in purely-documented/supported stuff can safely skip this part:

>> p = findprop(handle(gcf),'pos')
p =
    schema.prop

>> p.get
            Name: 'Position'
     Description: ''
        DataType: 'figurePositionType'
    FactoryValue: [100 100 660 520]
     AccessFlags: [1x1 struct]
         Visible: 'on'
     GetFunction: []
     SetFunction: []

在此简单代码段中,请注意,UDD hg.Figure类的position属性的默认值(FactoryValue)与根的DefaultFigurePosition属性返回的HG默认值不同.可以在此处找到有关UDD属性的更多信息.

In this simple snippet, note that the default (FactoryValue) for the position property of the UDD hg.Figure class is different than the HG default that is returned by the root's DefaultFigurePosition property. More information on UDD properties can be found here.

附录2013-02-13 :我刚刚发布了详细文章,解释了Matlab的Default和Factory属性值如何工作,它们如何相互关联以及如何访问它们.

Addendum 2013-02-13: I've just posted a detailed article explaining how Matlab's Default and Factory property values work, how they relate to each other, and how they can be accessed.

这篇关于获取0(根对象)的所有属性(包括隐藏的属性)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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