Back everything is correct. Create an initial tarball of the source source tree, and then drop it all into the source control so you can track and roll back your changes.
Take a look at Matlab depfun () and depdir (), which detect static dependencies. This can help you see the dependencies between Matlab features. With "depfun -toponly" in all files and a little line shuffling, you can create a list of immediate dependencies and drop it in the GraphViz file to create a large oriented graph of your code connections. Clusters on a graph can be a good place to split code. (EDIT: see Jonas solution, it looks like m2html does this for you.)
If you have more freedom to rewrite code, consider rewriting part of the code as objects using stateless utility classes with class methods and private functions as ways to combine related functions and provide some encapsulation. I worked with the fairly large Matlab codebases organized in this way, and everything works. In classic Matlab, classes are your only way to make some kind of packages. I believe the new OO Matlab system also supports a namespace.
If you do not want to convert the code to OO, you can organize related functions in subdirectories. This helps organize it to view the source code, at least.
All functions must have some doco in the standard hellext Matlab format, including the H1 line. If they do not, write comments about what you learned there. Then use the "contentrpt" tool to automatically create table of contents files for classes or directories.
Good luck.
Andrew Janke Feb 24 '10 at 19:30 2010-02-24 19:30
source share