假设我有以下文件结构:
+mypackage/
foo.m
bar.m
如何向 help(mypackage)
的输出添加帮助?
在 python 中,我只是在 __init__.py
中添加一个文档字符串。这里的等价物是什么?
最佳答案
根据 MATLAB 的 toolbox distribution documentation ,类似于 Python 的 __init__.py
文档字符串的 MATLAB 将是一个 help summary file .
使用上面的文件夹结构,我们可以添加一个 contents.m
文件来实现所需的行为:
+mypackage/
foo.m
bar.m
contents.m
给定一个基本的 contents.m
文件:
% This is contents.m
% This package contains:
% bar - Bar things
% foo - Foo things
我们实现了以下目标:
>> help mypackage
This is contents.m
This package contains:
bar - Bar things
foo - Foo things
关于matlab - 如何将文档添加到 matlab 包中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40179352/