Skip to content

Question: Add recommendation for a Contents.m file #37

@ehennestad

Description

@ehennestad

I like having a Contents.m file in the top level of a package because it supports using ver(<toolboxname>) and help(<toolboxname>) and will give version information and potentially custom documentation for a toolbox.

However, the toolbox/ structure breaks the use help, and ver commands for a of Contents.m file

  • MATLAB's ver and help commands rely on a Contents.m file placed in the root of a package.

    • With the recommended structure:
      repo-root/
      └── toolbox/
          ├── <functions>.m
          └── Contents.m
      
      the commands ver(<toolboxname>) or help(<toolboxname>) will not work and help toolbox is generic and can conflict if multiple toolboxes use the same folder name on the MATLAB path.
  • By contrast, using:

    repo-root/
    └── toolbox/
        └── <toolboxname>/
            │   └── <functions>.m
            └── Contents.m
    
    • The commands help <toolboxname> and ver <toolboxname> work as intended, showing the correct documentation and version for the user's package.

I also thought that the following could work, but it seems ver does not pick up Contents.m files placed within a namespace:

```
repo-root/
└── toolbox/
    └── +<toolboxname>/
        │   └── <functions>.m
        └── Contents.m
```

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions