Using static classes over packages
Show older comments
I'm planning to make a library of code for my team and I'm trying to plan how I structure this library. The fact that MATLAB only allows one function per file is very frustrating to me. Does anyone use static classes over packages to try and keep a cleaner and more readable code? I want to avoid having tonnes of function files, with some having as little as 10 lines. The main reason is to make this readable and prevent having to navigate back and forth between files as much as possible. I think that will encourage people to use this library. Is this a bad idea and I should stick to the packages format or is using static classes not a bad way to go?
2 Comments
Philip
on 11 Dec 2023
I am curious about how you decided to proceed? I have the exact same question. As an experienced python programmer it seems overly restrictive and unnartural for matlab code to have only one public function per file. So after learned that I can use static functions in a matlab classes, I immediately thought that would be a "better way" to approximate python modules in matlab. But I do not see much code in python that does this, so I am wondering if I should continue down this path.
Eugene Ofori
on 12 Dec 2023
Edited: Eugene Ofori
on 12 Dec 2023
Accepted Answer
More Answers (0)
Categories
Find more on Call Python from MATLAB in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!