MATLAB类的描述和详细描述属性

时间:2012-12-11 11:31:52

标签: oop matlab

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

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

1 个答案:

答案 0 :(得分:6)

使用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功能。