开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜