access (lot of small) functions residing in one MATLAB m file

Usually, you create one m-file for one MATLAB function. But what to do if you have many small functions? It’s odd to create a lot of files which just contain some lines of code. The other approach is to put the small functions just inside the m file where they are called from. This is a good solution, as long as you don’t have to access the same functions from multiple m-files!

So if you need to access many functions, which all reside in one m-file, just use the object oriented approach, by defining a Class and static methods:

Now, wherever you need to call any function of MyClass, just use:

Leave a Reply

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.