Description and DetailedDescription attributes of

2019-03-20 07:05发布

Built-in MATLAB classes have values for a Description and DetailedDescription attribute:

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

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

Similarly, some methods and properties of built-in classes have the same attributes:

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

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

How can I set these attributes for my classes/methods/properties?

标签: oop matlab
1条回答
Explosion°爆炸
2楼-- · 2019-03-20 07:49

Use arguments to the classdef:

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

Commandline:

>> ?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}

This is an undocumented feature it seems.

查看更多
登录 后发表回答