Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 233
Eric Avatar asked Oct 22 '25 16:10

Eric


1 Answers

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
like image 85
sco1 Avatar answered Oct 25 '25 05:10

sco1



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!