Description and DetailedDescription attributes of

2019-03-20 07:58发布

问题:

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?

回答1:

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.



标签: oop matlab