What is the closest thing MATLAB has to namespaces?

后端 未结 4 1919
挽巷
挽巷 2020-11-28 23:55

We have a lot of MATLAB code in my lab. The problem is there\'s really no way to organize it. Since all the functions have to be in the same folder to be called (or you have

4条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-11-29 00:12

    Another way to organize & reuse code is using matlab's object-oriented features. Each Object is customarily in a folder that begins with an "@" and has the file(s) for that class inside. (though the newer syntax does not require this for a class defined in a single file.) Using private folders inside class folders, matlab even supports private class members. Matlab's new class notation is relatively fully-featured, but even the old syntax is useful.

    BTW, my startup.m that examines a well-known location that I do my SVN checkouts into, and adds all of the subfolders onto my path automatically.

提交回复
热议问题