简体   繁体   中英

How do I add documentation to a matlab package?

Say I have the following file structure:

+mypackage/
  foo.m
  bar.m

How can I add help to the output of help(mypackage) ?

In python, I'd just add a docstring in __init__.py . What's the equivalent here?

Per MATLAB's toolbox distribution documentation , the MATLAB analog to Python's __init__.py docstring would be a help summary file .

Using the above folder structure, we can add a contents.m file to achieve the desired behavior:

+mypackage/
  foo.m
  bar.m
  contents.m

Given a basic contents.m file:

% This is contents.m
% This package contains:
%     bar - Bar things
%     foo - Foo things

We achieve the following:

>> help mypackage
  This is contents.m
  This package contains:
      bar - Bar things
      foo - Foo things

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM