oop – MATLAB类的Description和DetailedDescription属性

内置MATLAB类具有Description和DetailedDescription属性的值:

>> ?handle
ans = 
  meta.class handle
  Package: meta

  Properties:
                     Name: 'handle'
              Description: 'Base class for handle classes'
      DetailedDescription: ''
[snip]

类似地,内置类的某些方法和属性具有相同的属性:

>> a = ?containers.Map;
>> a.PropertyList(1)
ans = 
  meta.property handle
  Package: meta

  Properties:
                   Name: 'Count'
            Description: 'Number of pairs in the collection'
    DetailedDescription: ''
[snip]

如何为我的类/方法/属性设置这些属性?

使用classdef的参数:

classdef (Description='A type of story.',...
    DetailedDescription='Once upon a time..') MyFairyTaleClass

命令行:

>> ?MyFairyTaleClass

ans = 

  meta.class handle
  Package: meta

  Properties:
                     Name: 'MyFairyTaleClass'
              Description: 'A type of story.'
      DetailedDescription: 'Once upon a time..'
                   Hidden: 0
                   Sealed: 0
          ConstructOnLoad: 0
         HandleCompatible: 0
          InferiorClasses: {0x1 cell}

这似乎是一个undocumented功能.

相关文章
相关标签/搜索