How can I separate my Matlab object's code into different files?
I'm writing a Matlab object oriented program and the program is now getting to over 1000 lines. I wa开发者_JS百科nt to move parts of the script to other .m
files for easier maintenance.
Is there a way of doing this?
You can create a class folder, then place each of the methods for the class in a separate file in this folder (instead of in one large file).
No question, it is as well a matter of taste whether you put methods in a class folder or one class file. Regarding clarity I opt for the one class file approach.
Classes growing that large, might be a target for refactoring. Smaller classes are easier to maintain, document and test.
精彩评论