gpt4 book ai didi

matlab - 获取 0(根对象)的所有属性(包括隐藏的属性)

转载 作者:太空宇宙 更新时间:2023-11-03 19:27:45 25 4
gpt4 key购买 nike

似乎根对象,又名 0 在 Matlab 中具有隐藏属性。例如,DefaultTextInterpreter 就是其中之一:

 x = get(0,'DefaultTextInterpreter');

当我使用

 get(0)

我得到一个很长的列表,其中包括DefaultTextInterpreter


偶数设置undocumented properties可见

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

似乎没有帮助。


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

最佳答案

默认属性既未隐藏也未记录 - 它们可用于所有标准的 Handle Graphics 属性,只需在属性名称前加上“默认”前缀以及对象类型(“线”、“轴”等)。这在 the official documentation 中有解释。 .

事实上,这种机制也适用于隐藏/未记录的属性,如shown对于 LineSmoothing 属性。

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

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

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

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


因为我情不自禁:-),这里有一些现在真正没有记录的知识,它不能回答 OP 问题,但它在某种程度上是相关的。只对原始问题或纯粹记录/支持的东西感兴趣的读者可以安全地跳过这部分:

>> 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 类的位置属性的默认值 (FactoryValue) 不同于根的 DefaultFigurePosition 属性返回的 HG 默认值。可以找到有关 UDD 属性的更多信息 here .

附录 2013-02-13:我刚刚发布了一个 detailed article解释 Matlab 的 Default 和 Factory 属性值如何工作、它们如何相互关联以及如何访问它们。

关于matlab - 获取 0(根对象)的所有属性(包括隐藏的属性),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9268496/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com